| 
			
			 | 
		#1 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 5 
				Karma: 10 
				Join Date: Feb 2010 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Calibre Command Line Interface TOC
			 
			
			
			Is there an option to specify a TOC file from the command line interface? If so, what is the format for the input file? 
		
	
		
		
		
		
		
		
		
		
		
		
	
	If the above is not an option, what is a simple method for correctly creating a valid TOC when using 'ebook-convert' from the command line - bearing in mind that I can dynamically format the input file however I like. Examples welcome.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Comparer of the Ephemeris 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,496 
				Karma: 424697 
				Join Date: Mar 2009 
				
				
				
				Device: iPad 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			to see the options for ebook-convert, from a command line type: 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Code: 
	ebook-convert foo.mobi bar.mobi --help Replace foo.epub and bar.mobi with extensions more appropriate to your task, perhaps foo.html and bar.epub. G  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#3 | |
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 5 
				Karma: 10 
				Join Date: Feb 2010 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 "By default, if the source file has a Table of Contents, it will be used in preference to the automatically generated one." So, at the beginning of my HTML file, I can make: <div id="tocdiv"> <a class="toc" href="#chapter1">Chapter 1 link</a> etc... Then add the switch: --level1-toc="//h:a[re:test(@class, 'toc', 'i')]" to use the links in that div as the TOC? I'm basing the parameter info on this post: https://www.mobileread.com/forums/showthread.php?t=63898  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Comparer of the Ephemeris 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,496 
				Karma: 424697 
				Join Date: Mar 2009 
				
				
				
				Device: iPad 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			What happens when you try it?
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
| Tags | 
| command line, table of contents, toc | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| [Old Thread] Calibre Command line and .bat file | stratman | Calibre | 15 | 01-10-2012 06:38 PM | 
| Autotagging with Calibre (command line) | erion | Calibre | 11 | 08-28-2010 02:33 PM | 
| Calibre Command Line usage with PHP | artoros | Related Tools | 13 | 07-01-2010 10:57 AM | 
| calibre command line utilities and calibre defaults | astrodad | Calibre | 2 | 08-07-2008 04:27 PM | 
| Command line interface to import to libprs500 database | astrodad | Calibre | 3 | 01-17-2008 11:53 AM |