View Single Post
Old 01-25-2011, 07:55 AM   #1
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
Markdown Syntax in Comments

I am seeing cases where the Comments field retrieved by Calibre is in what looks like Markdown Syntax (for a simple example look at "Off the Mangrove Coast" by Louis L'Amour). When Calibre adds this comment it appears that it is being enclosed in a <div> and <p> tag to support rich Text Editing in the GUI comments field. I am trying to produce a web page incorporating this comment field, and the presence of the HTML tags stops markdown processing from operating on the field to give a better formatted comment.

It seems to me I that there are several options available
  • I hard-code knowledge of Calibre's enclosing tags and remove them so that I can apply Markdown processing. I am not enamoured of this approach as any change at the Calibre level is liable to break my code. It also does not benefit the average Calibre user.
  • Calibre does not put those tags around the Comments field if the text is plain text. This would mean that later Markdown processing is possible relatively easily. At the moment I am not sure what the Calibre Content Server does with Markdown syntax in comments (if anything).
  • Calibre processes the markdown at the point of receipt and converts it to (X)HTML before inserting it into the Comments field.
There may be options I have missed - anyone want to comment on that? Also are there related issues that I have missed in my initial analysis?

Of the options I have listed, the most effective to me seems the last one of converting to HTML at the point the Markdown hits Calibre. If that is what others think I will look at raising an appropriate ticket for an enhancement request. I can then look at whether I can work out the Calibre patch to go with the request, but first I thought I would solicit advice on the best way to proceed.
itimpi is offline   Reply With Quote