asciidoctor / asciidoctor-epub3

:blue_book: Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3
https://asciidoctor.org
MIT License
216 stars 67 forks source link

How to style pygments BW theme to remove red error borders #81

Closed jawache closed 4 years ago

jawache commented 7 years ago

I'm using pygments, it doesn't quite support the idea of typescript yet and inline HTML and draws these red borders around my code snippets.

https://www.dropbox.com/s/3hixxbxfg91jx8w/Screenshot%202017-01-19%2023.40.36.png?dl=0

In the HTML version of asciidoctor i just added the css to ignore .tok-err but i'm not sure what to set to get it working in the epub version (i've set the same CSS and it's not working)

.tok-err { border: none !important; }

I've tried viewing the epub in calibri but in the HTML there the red border is already inlined in the HTML and therefore it's hard to figure out what classes to use to style?

Any hints ideas? Even if it's how to view an EPUB in some prebuilt form where I can see the classes?

mojavelinux commented 7 years ago

The red border indicates that there is an error in highlighting...technically you should be able to correct all those before the final version of your publication.

If you cannot, you need to provide your own Pygments theme using your own Pygments installation. That's where the styles are coming from. It works the same in all Asciidoctor converters (when you are inlining the styles, as we do in the EPUB3 converter).

To use your own installation of Pygments, which is where you can define or override the theme, follow this guide:

http://asciidoctor.org/docs/user-manual/#using-a-custom-pygments-installation

mojavelinux commented 7 years ago

In addition to those instructions, I did the following:

I'm not sure how else to provide a custom style to Pygments. We don't have direct access to Python code, so we have to hack Pygments directly. If you know of another way, I could certainly help get it working. For now, this is the only way I know how.

mojavelinux commented 7 years ago

The other approach is to set the pygments-css attribute to class. However, then you have to use a custom epub3.css stylesheet and add the rules to it, as described in https://github.com/asciidoctor/asciidoctor-epub3#about-the-theme.

slonopotamus commented 4 years ago

Since we're going to phase pygments.rb (#262) out, I'm closing this as WONTFIX.