-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difficult to use pygments classes #30
Comments
Interesting, I wasn't aware that Jekyll shipped with a Pygments stylesheet. As you noticed, Asciidoctor hardcodes the (a) First, you can instruct Asciidoctor to inline the styles for Pygments using the setting (b) Second, you can use Asciidoctor to write the Pygments stylesheet instead of using the one provided by Jekyll. You can do this by calling the following API: Asciidoctor::Stylesheets.instance.write_pygments_stylesheet '_site/css', 'pastie' Then, include that stylesheet (e.g., css/pygments-pastie.css) in your main template. Note the using Asciidoctor's version is important because it provides the necessary styles to override AsciiDoc styling. It's tricky because everyone wants to be king when it comes to styles ;) Perhaps this is something that could be handled by the Jekyll AsciiDoc plugin transparently. Thoughts? |
I had to work around the fact that I wasn't really sure where and how to hack in Ruby/Sass support. I've enabled the Asciidoctor highlight-source and it generates the HTML elements properly, all I had to do was use some sed to inject the front-matter and rename the classes to the convention asciidoctor uses, then I moved it into
Now I can just use front-matter variable We could just add these to the (quickstart) project and be done with it. Since this specific repo doesn't carry any styles whatsoever, quickstart does and has the CSS for a bunch of other vendor libs too. This makes pygments more the exception, than anything else. If you want, I've got the files and could do a pull request, minor effort. |
@amr What do you mean by 'by default'. I tried |
Sounds reasonable to me. The CodeRay stylesheet was added just because that was Jared's preference, but I think the project should provide both for parity. |
Sorry for the late response. I'll have another look at this and submit a pull request if it hasn't been done yet. Thanks for the feedback. |
Actually, I misspoke. Including the styles inline does still honor the theme. |
The integration with Pygments in Asciidoctor really calls for the Pygments stylesheet that Asciidoctor generates (which is backed by the Pygments API, making all the themes in Pygments available). Therefore, I've decide to auto-generate the CSS file into the
By default, the stylesheet is written to The file will be written if it does not exist or the contents have changed. The Pygments theme is selected by the value of the The file will then get copied to the output directory by Jekyll. |
- automatically generate stylesheet for Pygments - add pygments.rb as a development dependency - add test to verify integration with Pygments - document integration with Pygments
You'll be able to disable this feature in one of two ways. First, you can switch to inline styles: asciidoctor:
attributes:
- pygments-css=style Or you can disable the pygments-stylesheet attribute: asciidoctor:
attributes:
- pygments-stylesheet! |
- automatically generate stylesheet for Pygments - add pygments.rb as a development dependency - add test to verify integration with Pygments - document integration with Pygments - disable feature when using JRuby
Hi,
Jekyll by default uses pygments, and ships with a
_syntax-highlighting.scss
file. With this configuration...... syntax highlighting doesn't work. The reason is that
asciidoctor
uses a customtok-
class prefix. So all pygments stylesheets do not work by default and must be modified to include thetok-
prefix.Is it possible to tell asciidoctor to not use that prefix?
The text was updated successfully, but these errors were encountered: