| 
			
			 | 
		#1 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 2 
				Karma: 10 
				Join Date: Dec 2019 
				
				
				
				Device: Web + Pixel(Android) 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Custom CSS for TXT -> EPUB conversion
			 
			
			
			Hi there. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I'm working with numerous documents which, for ease of mass-editing, I'd like to keep in .TXT format. I have no problems converting them to EPUB format. Everything seems fine. HOWEVER I'd like to modify (or even replace) the default CSS that gets embedded into the .EPUB. When I use epub-convert with the --extra-css "blah.css", the contents are added to the "contents.xhtml" in a style block, but no-where else! Is it possible to embed contents into the "stylesheet.css", or add a new "style.css" to be loaded alongside it, for the entire "book"? Maybe I am missing something in the command line arguments - ideas? Code: 
	ebook-convert '.\input.txt' '.\output.epub' --formatting-type markdown --input-encoding UTF-8 --markdown-extensions=footnotes,tables,toc,smarty,nl2br --paragraph-type=single --epub-inline-toc --extra-css "./custom.css"  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			All style rules are merged and flattened during conversion. Including extra css. If you want to override the styles applied by the markdown input plugin give your custom css higher precedence, the most foolproof way to do that is by using !important in your css properties.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 2 
				Karma: 10 
				Join Date: Dec 2019 
				
				
				
				Device: Web + Pixel(Android) 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			But that is what I don't understand... 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I use the ebook-convert with the following arguments: Code: 
	ebook-convert '.\Pathless Trail - Manual Edit.txt' .\PT.epub --formatting-type markdown --input-encoding UTF-8 --markdown-extensions=footnotes,tables,toc,smarty,nl2br --extra-css "./custom.css" Code: 
	.mytitle {
    display: block;
    font-size: 1.41667em;
    font-weight: bold;
    line-height: 1.2;
    margin: 0.83em 0;
	text-align:center
    }
.mysubtitle {
    display: block;
    line-height: 1.2;
    text-align:center;
    color:blue
    }
Code: 
	Conversion options changed from defaults: extra_css: './custom.css' markdown_extensions: 'footnotes,tables,toc,smarty,nl2br' formatting_type: 'markdown' input_encoding: 'UTF-8' ...  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			class names are not guaranteed to be preserved by coversion. Only final styles. Look for the styles.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
| Thread Tools | Search this Thread | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| TXT to EPUB conversion issue | rockeh | Conversion | 2 | 03-18-2011 11:50 AM | 
| Preserving <br /> on epub -> txt conversion | billingd | Calibre | 1 | 08-11-2010 07:24 AM | 
| ePub with custom .css on a 505 | dicknskip | Sony Reader Dev Corner | 3 | 06-10-2010 12:34 AM | 
| Conversion: EPUB to TXT | Starson17 | Calibre | 11 | 05-29-2010 01:31 PM | 
| ePub conversion: override existing css with a custom one | sbin | Calibre | 1 | 01-09-2010 05:03 AM |