01-05-2012, 04:15 AM | #1 |
Blue. Not sad...just blue
Posts: 218
Karma: 1267018
Join Date: Oct 2009
Location: Japan
Device: Ridibooks Paper Pro
|
Markdown: Anchor inconsistency on Kindle & Sony
This is less a calibre problem than just not knowing how to do this correctly.
I've been successfully using Markdown-formatted text to create Mobi files for my Kindle, but converting the same source into ePub for my new Sony T1 is giving me a little trouble. Specifically link anchors. People who know more than me, please help. If I want to link to the beginning of a header, I've been doing this: Code:
# Chapter 4 Blablabla... <a name="anchorForChapter5"></a> # Chapter 5 Blablabla... But. The Sony seems to jump to links by going to the page that contains the link, and then just displaying that page as though I'd paged to it manually. So if a link happens to wind up at the bottom of the page, then so be it. Unfortunately for my method, that means that the Markdown source above takes us to the end of Chapter 4, with Chapter 5 hidden behind the next page break. Oops. Well that is indeed what I'm explicitly telling it to do (pesky computers, taking me literally ), but the Kindle was polite enough to pretend not to notice. What would be a process to link directly to/near headers that would work on both machines? |
01-05-2012, 04:26 AM | #2 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use explicit markup for chapter titles
<h1 id="anchorForChapter5">Chapter 5</h1> Though you can just use the table of contents directive to have calibre autogenerate your toc in markdown documents. |
Advert | |
|
01-05-2012, 08:36 AM | #3 |
Guru
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Kovid's solution should work, or what about trying:
Code:
# Chapter 4 Blablabla... # Chapter 5 <a name="anchorForChapter5"></a> Blablabla... If this skips the chapter header you could try: Code:
# Chapter 4 Blablabla... # <a name="anchorForChapter5"></a>Chapter 5 Blablabla... I use calibre to convert markdown to ePub for a Sony reader and find that it does jump to the correct position of anchors within a page. Last edited by Agama; 01-05-2012 at 02:50 PM. Reason: Typo |
01-05-2012, 10:06 AM | #4 |
Blue. Not sad...just blue
Posts: 218
Karma: 1267018
Join Date: Oct 2009
Location: Japan
Device: Ridibooks Paper Pro
|
Okay it looks like embedding the anchor into the header is the way to go for cross-platform compatibility. Putting the link before the header makes the Sony display the previous section. Putting the link after the header makes the Kindle fail to display the header text.
I think I've got it now. Thanks for the help! Here's my test Markdown code, for anybody who wants to see it for themselves: Spoiler:
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle & Sony Reader | negerkuss_77 | Amazon Kindle | 3 | 12-27-2011 08:17 AM |
Markdown conversion: line spacing & lists | Snorkledorf | Conversion | 16 | 11-09-2011 07:51 AM |
Bargain (Kindle/Nook/Sony/Kobo) Simon & Schuster Science Fiction & Fantasy $3.99 | hemisphire | Deals and Resources (No Self-Promotion or Affiliate Links) | 1 | 10-14-2011 02:38 PM |
Using calibre for Sony Pocket & Kindle | grizedale | Calibre | 3 | 08-04-2010 03:00 PM |
Kindle 1.2 update makes boat anchor | scotty1024 | Amazon Kindle | 17 | 03-18-2009 12:34 AM |