| 
			
			 | 
		#1 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090 
				Karma: 447222 
				Join Date: Jan 2009 
				Location: Valley Forge, PA, USA 
				
				
				Device: Kindle Paperwhite 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Inline TOC formatting
			 
			
			
			I generated a 3 level inline TOC, and wanted to change the styling for the different levels 
		
	
		
		
			In Sigil, each level had it's own class, so it was trivial to replace Sigil's TOC.CSS with the one that I liked to use The Editor will generate a toc.xhtml file with a <ul> <li> <ul> <li> etc. nested, and with the <style type="text/css"> in the toc.xhtml file If I change the CSS for the <li> the container value is inherited, and something like font-size:1.25em; really gets ugly. 1. IHMO it's be more flexible if each TOC level had it's own class 2. In the epub, I tweaked some generated settings, and the font-size I added really got messed up. Is there a correct way? 3. My end goal would be to have (maybe) ... H1 enteries = bold, 2em, 1 em below, H2 enteries = bold, 1em, 1 em below, H3 enteries followed by another H3 = normal, 1em, 0 em below, H3 enteries NOT followed by another H3 = normal, 1em, 2 em below OK, that might be ugly, but it's an example of TOC level-specific styling Open to alternatives, but in this case, I think Sigil's approach might possibly be more flexible  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Ex-Helpdesk Junkie 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421 
				Karma: 85400180 
				Join Date: Nov 2012 
				Location: The Beaten Path, USA, Roundworld, This Side of Infinity 
				
				
				Device: Kindle Touch fw5.3.7 (Wifi only) 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			You can use descending CSS selectors, specifically the Child Selector in order to strictly control which one is matched. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Perhaps Kovid could add in classes to the ToC generator; however, this should work in the meantime, or you could just add classes by hand.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090 
				Karma: 447222 
				Join Date: Jan 2009 
				Location: Valley Forge, PA, USA 
				
				
				Device: Kindle Paperwhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			thanks, I was actually out to W3Schools (http://www.w3schools.com/css/default.asp) searching for something like that. I will do some experimenting 
		
	
		
		
		
		
		
		
		
		
		
		
	
	The reason I was hoping Kovid would consider some changes is because the TOC is regenerated each time. Life would be easier if the user could have a style sheet with the TOC styles so that the toc.xhtml would only require minimal tweaking. Adding classes by hand would be a real source of error  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			You do not need to add classes, CSS 2.1 selectors can do all this via child selectors. For example for level 1 
		
	
		
		
		
		
		
		
		
		
		
		
	
	#calibre_generated_inline_toc > ul > li For level 2 #calibre_generated_inline_toc > ul > li > ul > li And just go on adding > ul >li for every additional level.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | |
| 
			
			
			
			 Ex-Helpdesk Junkie 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421 
				Karma: 85400180 
				Join Date: Nov 2012 
				Location: The Beaten Path, USA, Roundworld, This Side of Infinity 
				
				
				Device: Kindle Touch fw5.3.7 (Wifi only) 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 #toc_level_1 is doing. It can't hurt to add classes, can it?  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Ex-Helpdesk Junkie 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421 
				Karma: 85400180 
				Join Date: Nov 2012 
				Location: The Beaten Path, USA, Roundworld, This Side of Infinity 
				
				
				Device: Kindle Touch fw5.3.7 (Wifi only) 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks for adding this! 
		
	
		
		
		
		
		
		
		
		
		
		
	
	@phossler, this will be in the next release, tomorrow. Use class "level1" "level2" etc. See: https://github.com/kovidgoyal/calibr...88fb41893d5b70  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090 
				Karma: 447222 
				Join Date: Jan 2009 
				Location: Valley Forge, PA, USA 
				
				
				Device: Kindle Paperwhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			@all-- THANKS !!!  
		
	
		
		
		
		
		
		
		
		
		
		
	
	![]() This will make things much easier for me (at least) to understand as well as saving some work  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090 
				Karma: 447222 
				Join Date: Jan 2009 
				Location: Valley Forge, PA, USA 
				
				
				Device: Kindle Paperwhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			@Kovid 
		
	
		
		
			Can I ask why it goes from Level 1 to Level 2 to Level 5? No big deal, just curious Thanks Now I have to figure out how to use it  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Dead account. Bye 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 587 
				Karma: 668244 
				Join Date: Mar 2011 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Just guessing, but check if what you have in your book is h1, h2 and then h5, not h3, tags.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Retaining formatting in inline links | MacEachaidh | ePub | 4 | 03-16-2014 05:11 PM | 
| Inline TOC from toc.ncx | elmago79 | Kindle Formats | 38 | 03-25-2011 01:56 PM | 
| Use Regex to Code an Inline TOC, from an External TOC's .ncx File | mostlynovels | ePub | 2 | 03-16-2011 01:15 PM | 
| Tags around inline TOC links | jhempel24 | Sigil | 0 | 01-08-2011 07:21 AM | 
| Trying to make an Inline TOC | crutledge | Sigil | 2 | 05-09-2010 06:46 AM |