![]() |
#1 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jun 2010
Device: Moto Droid
|
TOC question
How do i generate TOC from a plain txt file that has no markup, or HTML, but only:
blahblahblah. Or should I just figure out a sed regex to add <h1> or whatever tags before I run it thru Calibre?
Chapter 2 Blahblahblah |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Edit your .TXT file's headings using markdown like so:-
Code:
# My Book Title # My Book's Author ///Table of Contents/// ## CHAPTER 1 ... blah blah blah ... ## CHAPTER 2 ... blah blah blah ... The ///Table of Contents/// line should be placed where you want the internal TOC to be. When you're done editing, convert the TXT file, but make sure you check the [Convert] - [TXT Input] - "Process using markdown" box. You can read more about markdown here Good Luck ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jun 2010
Device: Moto Droid
|
That works, thanks
|
![]() |
![]() |
![]() |
#4 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 281
Karma: 52007
Join Date: Jun 2010
Device: nook
|
However, I did find out the hard way that Markdown considers indenting to mean "wrap this in <code> tags"
I had been using tabs in my text file to mark paragraphs. When I used the markdown method to create a TOC, the entire book turned into monospaced non-broken lines. Removing the tabs and adding blank lines between the paragraphs fixed the problem. |
![]() |
![]() |
![]() |
#5 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
This is not really a problem because Markdown is designed to work that way. It's described in the Markdown reference under [Code Blocks]. Starting a line with at least 4 spaces or 1 tab triggers a code block.
Incidentally, ending a line with 2 spaces triggers a hard line break, which can be useful. Markdown is an excellent pre-processor for generating ebooks from plain text. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 324
Karma: 1057749
Join Date: May 2010
Location: LA, CA
Device: Kindle Paperwhite 2013
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Glad to have helped
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
TOC question for JBL | Pranananda | Ectaco jetBook | 1 | 06-22-2010 07:55 AM |
6.0 TOC question | Amalthia | Calibre | 3 | 07-30-2009 12:45 PM |
New to Calibre... TOC question | ruchti | Calibre | 10 | 06-08-2009 05:53 PM |
BD TOC Question | Novasea | Workshop | 5 | 10-27-2008 11:38 AM |
toc question | zelda_pinwheel | IMP | 4 | 01-18-2008 10:49 AM |