MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Conversion (https://www.mobileread.com/forums/forumdisplay.php?f=235)
-   -   How to convert to an Epub file without css and class? (https://www.mobileread.com/forums/showthread.php?t=339367)

The_book 05-12-2021 05:12 AM

How to convert to an Epub file without css and class?
 
I hope that the converted epub file does not contain any format other than html tags, that is, no class and css. What should I do?

theducks 05-12-2021 09:37 AM

Just Convert and see ;)
Most browsers (book viewers) have built in defaults for common tags.

If you don't like what you see, then add a CSS to put your spin on the tag.

JSWolf 05-12-2021 09:40 AM

Quote:

Originally Posted by theducks (Post 4120828)
Just Convert and see ;)
Most browsers (book viewers) have built in defaults for common tags.

If you don't like what you see, then add a CSS to put your spin on the tag.

If the eBook has inline styles, then those will be converted to CSS and can be edited from there as needed.

The_book 05-12-2021 10:02 AM

Quote:

Originally Posted by theducks (Post 4120828)
Just Convert and see ;)
Most browsers (book viewers) have built in defaults for common tags.

If you don't like what you see, then add a CSS to put your spin on the tag.

What I mean is, for example, when I convert a txt/markdown file to Epub by Calibre, class and css will be added by Calibre. Is there a opinion in Calibre that I can use to convert to a Epub without css and class?

JSWolf 05-12-2021 10:13 AM

Why do you want an ePub with no CSS? The defaults are not all good. You do need CSS to fix up some of the defaults.

You really should not be trying to do ePub with no CSS. It just isn't a good idea.

DNSB 05-12-2021 02:38 PM

Quote:

Originally Posted by The_book (Post 4120835)
What I mean is, for example, when I convert a txt/markdown file to Epub by Calibre, class and css will be added by Calibre. Is there a opinion in Calibre that I can use to convert to a Epub without css and class?

Why bother converting then? The use of classes and stylesheets is what makes epub worthwhile.

hobnail 05-12-2021 03:51 PM

Quote:

Originally Posted by The_book (Post 4120835)
What I mean is, for example, when I convert a txt/markdown file to Epub by Calibre, class and css will be added by Calibre. Is there a opinion in Calibre that I can use to convert to a Epub without css and class?

If necessary you could open the epub in Calibre's editor and delete the css file. There might be class= stuff in the html but they won't have any effect since there isn't a css file.

DNSB 05-12-2021 06:05 PM

Quote:

Originally Posted by hobnail (Post 4120969)
If necessary you could open the epub in Calibre's editor and delete the css file. There might be class= stuff in the html but they won't have any effect since there isn't a css file.

You do know that you can define classes in the html files? Not to mention some people's unnatural love for in-line styles? The code block is a sample from a Randy Penguin ebook's next read blurb.

Code:

  <style>
                        @font-face {font-family: 'Shift Light'; font-style: normal; font-weight: bold; src: url('../Fonts/Shift-Bold.otf');}
                        @font-face {font-family: 'Shift Light'; font-style: italic; font-weight: bold; src: url('../Fonts/Shift-BoldItalic.otf');}
                        div {margin: 0; padding: 0; line-height: inherit; text-indent: 0;}
                        h1 {font-size: 1.5em; text-align: center; margin: 0 0 1em 0; font-weight: bold; font-style: italic; line-height: inherit; text-indent: 0; font-family: 'Shift Light', Palatino, 'Palatino Linotype', 'Palatino LT STD', 'Book Antiqua', Georgia, serif;}
                        p {text-align: center; text-indent: 0; margin: 1em 0 0 0; font-family: 'Shift Light', Palatino, 'Palatino Linotype', 'Palatino LT STD', 'Book Antiqua', Georgia, serif;}
                        .center{text-align: center;}
                        .x-small {font-weight: bold; font-size: 1em; margin: 0; padding: 0;}
                        .image_h12{font-size: 1em; height: 12em; max-width: 100%;}
                        a, a:link, a:visited, a:hover, a:active {font-weight: bold; font-size: 1.2em; color: #fa6400; text-decoration: underline;}
                        .rule {font-size: 1em; margin: 1.2em 5% 0 5%; border-top: 1px solid #636363;}
                </style>


JSWolf 05-12-2021 06:11 PM

What's the point of an ePub with no CSS?

retiredbiker 05-12-2021 06:14 PM

Saved searches - I actually use all these on some files:

<div.*?> replace with nothing
<span.*?> replace with nothing
<a.*?> replace with nothing
id=".*?" replace with nothing
<p.*?> replace with <p>

That gives you a pretty unstyled document in a few seconds.

hobnail 05-12-2021 06:15 PM

Quote:

Originally Posted by DNSB (Post 4120995)
You do know that you can define classes in the html files? Not to mention some people's unnatural love for in-line styles?

Urk, how could I forget those monstrosities?

JSWolf 05-12-2021 06:18 PM

Quote:

Originally Posted by DNSB (Post 4120995)
You do know that you can define classes in the html files? Not to mention some people's unnatural love for in-line styles? The code block is a sample from a Randy Penguin ebook's next read blurb.

Code:

  <style>
                        @font-face {font-family: 'Shift Light'; font-style: normal; font-weight: bold; src: url('../Fonts/Shift-Bold.otf');}
                        @font-face {font-family: 'Shift Light'; font-style: italic; font-weight: bold; src: url('../Fonts/Shift-BoldItalic.otf');}
                        div {margin: 0; padding: 0; line-height: inherit; text-indent: 0;}
                        h1 {font-size: 1.5em; text-align: center; margin: 0 0 1em 0; font-weight: bold; font-style: italic; line-height: inherit; text-indent: 0; font-family: 'Shift Light', Palatino, 'Palatino Linotype', 'Palatino LT STD', 'Book Antiqua', Georgia, serif;}
                        p {text-align: center; text-indent: 0; margin: 1em 0 0 0; font-family: 'Shift Light', Palatino, 'Palatino Linotype', 'Palatino LT STD', 'Book Antiqua', Georgia, serif;}
                        .center{text-align: center;}
                        .x-small {font-weight: bold; font-size: 1em; margin: 0; padding: 0;}
                        .image_h12{font-size: 1em; height: 12em; max-width: 100%;}
                        a, a:link, a:visited, a:hover, a:active {font-weight: bold; font-size: 1.2em; color: #fa6400; text-decoration: underline;}
                        .rule {font-size: 1em; margin: 1.2em 5% 0 5%; border-top: 1px solid #636363;}
                </style>


That mess is not a problem at all. I just delete the HTML file as I don't need or want it.

The_book 05-13-2021 12:29 AM

Quote:

Originally Posted by DNSB (Post 4120945)
Why bother converting then? The use of classes and stylesheets is what makes epub worthwhile.

Because I want the toc in the Epub.

pure txt do not have toc.

markdown support toc, but I haven't find a book reader support reading markdown files

hobnail 05-13-2021 01:34 AM

Quote:

Originally Posted by DNSB (Post 4120995)
You do know that you can define classes in the html files? Not to mention some people's unnatural love for in-line styles?

There's also the thing where you can have css in the head. But the OP said he's converting from text/markdown with calibre. Does Calibre add in-line styles inside the resulting html/xhtml files?

davidfor 05-13-2021 03:01 AM

Quote:

Originally Posted by The_book (Post 4121065)
Because I want the toc in the Epub.

pure txt do not have toc.

markdown support toc, but I haven't find a book reader support reading markdown files

So why don't you want any CSS in the epub? Calibre won't convert a book without generating a basic CSS. But, you can remove or replace it. If you remove it, you are completely dependent on how what you are reading it with decides to style the tags.


All times are GMT -4. The time now is 05:49 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.