Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 03-01-2012, 04:09 AM   #1
Snorkledorf
Blue. Not sad...just blue
Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.
 
Snorkledorf's Avatar
 
Posts: 218
Karma: 1267018
Join Date: Oct 2009
Location: Japan
Device: Ridibooks Paper Pro
Markdown: Direct image references?

calibre seems to ignore files directly referenced via HTML inside a Markdown file, both during initial import into the .txtz file, and then during conversion (that is, if I manually open the .txtz file, add in the missing files, and re-zip it, calibre still ignores them during conversion).

Is there a setting somewhere that'd allow me to directly reference files like this?


The reason that I'm trying to use HTML here is that I want to center and right-justify some images, but images referenced in Markdown style within <div> tags, like this...

Code:
<div style="text-align: center">
![text][myImage]
</div>

[myImage]: images/file.png
...don't work (they remain text).

So instead I'm trying to reference the image directly with HTML, like this:

Code:
<div style="text-align: center">
<img src="images/file.png" alt="text">
</div>
BBEdit and Marked (a Mac Markdown viewer app) both happily preview this useage, but calibre doesn't like it.

Any hints?

Thanks!
Snorkledorf is offline   Reply With Quote
Old 03-01-2012, 07:36 AM   #2
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Calibre is correct in doing this since Markdown formatting syntax is not processed within block-level HTML tags, such as DIV. This is part of the Markdown specification. See http://daringfireball.net/projects/markdown/syntax#html

If you are converting to ePub then you could use calibre's Tweak ePub function to explode the ePub and add your required <div> tags. In this case you do not need to specify these <div> tags in the markdown, just use the normal image syntax.

I'm note sure why your second syntax doesn't work. Do you have an images folder relative to your markdown text file?

An alternative option would be to use Textile instead of Markdown as it has more tag and style capabilities. See http://textile.thresholdstate.com/

Last edited by Agama; 03-01-2012 at 07:45 AM.
Agama is offline   Reply With Quote
Advert
Old 03-01-2012, 08:23 AM   #3
Snorkledorf
Blue. Not sad...just blue
Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.Snorkledorf ought to be getting tired of karma fortunes by now.
 
Snorkledorf's Avatar
 
Posts: 218
Karma: 1267018
Join Date: Oct 2009
Location: Japan
Device: Ridibooks Paper Pro
Yes, the Markdown-syntax images are being cherry-picked from the same "images" folder that contains the <img> tag images. Both my previewer apps can see all the images, so they're all accessible. I just don't know if it's a known thing that calibre isn't designed to do, or if I'm doing something screwy on my end.

Thanks for the heads-up on Textile; I hadn't thought of that. It turns out that my previewer app Marked can use a Textile engine for its display, so that's a minimal disruption of my workflow. Should be very interesting to try. Now I've just got to start from square one again and learn the syntax...
Snorkledorf is offline   Reply With Quote
Old 03-01-2012, 03:47 PM   #4
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Quote:
Originally Posted by Snorkledorf View Post
Should be very interesting to try. Now I've just got to start from square one again and learn the syntax...
I found the Tweak ePub solution to be quicker and I like the simplicity of markdown. You can help the Tweak process by defining your markdown images as follows:

Code:
![left](img/image.gif)

![right](img/image.gif)

![center](img/image.gif)
The value of the alt attribute of the generated <img> tags gets the value in square brackets, so you can use this in a regex to do a one-shot style update across all xhtml files in your ePub to apply the required text-align.

Last edited by Agama; 03-01-2012 at 04:01 PM.
Agama is offline   Reply With Quote
Old 07-11-2013, 12:06 PM   #5
anywho
Connoisseur
anywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watchanywho is clearly one to watch
 
Posts: 58
Karma: 10970
Join Date: Jul 2010
Device: Kindle
I'm having the same problem:

![image](images/kiwi_kiki.png)

This works in several markdown editors ( http://mouapp.com/ , http://multimarkdown.com/ )

but does not work in Calibre.

Did anyone find a solution?
anywho is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
markdown-calibre bobb40 Conversion 1 07-08-2011 12:02 PM
->Txt+Markdown Perkin Calibre 2 12-11-2010 04:04 AM
multiple references troymc Sigil 3 05-06-2010 03:20 PM
Unutterably Silly Why all the Lovecraft references? Mobile Mason Lounge 3 12-03-2009 12:53 PM
Markdown editor user_none Workshop 0 08-30-2009 09:25 PM


All times are GMT -4. The time now is 06:25 PM.


MobileRead.com is a privately owned, operated and funded community.