wasamasa / nov.el

Major mode for reading EPUBs in Emacs
GNU General Public License v3.0
654 stars 34 forks source link

Inline color styles are not honored #45

Closed dov closed 5 years ago

dov commented 5 years ago

The book https://www.jyotirmoy.net/posts/2018-12-01-rust-book.html is a good example of a typical programming epub. It contains code snippets that have been syntax highlightened and annotated with tags like <span class="pp">println!</span>(<span class="st">&quot;Hello, world!&quot;</span>);. The xhtml also contains an inline style sheet which defines the attributes of these classes:

code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */

But these styles are not honored in the display and the code is displayed in black only.

See: ch002.xhtml of the reference epub.

wasamasa commented 5 years ago

This major mode uses shr.el for the rendering which doesn't support CSS at all, only color attributes for tables. Please contact Lars Ingebritsen if you really want CSS rendering to happen (bonus: You'd get it working in M-x eww as well as it uses the same rendering library).