[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Code block syntax highlighting in async export
From: |
David Lukeš |
Subject: |
Re: Code block syntax highlighting in async export |
Date: |
Mon, 3 Oct 2022 21:32:27 +0200 |
> I have realized that
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-elisp.html
> has colorized source blocks. The file is created using
> https://git.sr.ht/~bzg/worg/blob/master/publish.sh and the script is
> executed inside a container with no available DISPLAY.
Well spotted! I think the trick there is setting
org-html-htmlize-output-type to 'css. See the variable's
documentation:
Choices are css to export the CSS selectors only,inline-css
to export the CSS attribute values inline in the HTML or nil to
export plain text. We use as default inline-css, in order to
make the resulting HTML self-containing.
However, this will fail when using Emacs in batch mode for export, because
then no rich font definitions are in place. It will also not be good if
people with different Emacs setup contribute HTML files to a website,
because the fonts will represent the individual setups. In these cases,
it is much better to let Org/Htmlize assign classes only, and to use
a style file to define the look of these classes.
To get a start for your css file, start Emacs session and make sure that
all the faces you are interested in are defined, for example by loading files
in all modes you want. Then, use the command
M-x org-html-htmlize-generate-css to extract class definitions.
So, still a workaround, technically, but a nice and clean one that
definitely deserves to be mentioned in this context!
Best,
David
- Re: Code block syntax highlighting in async export, (continued)
- Re: Code block syntax highlighting in async export, Ihor Radchenko, 2022/10/02
- Re: Code block syntax highlighting in async export, Max Nikulin, 2022/10/02
- Re: Code block syntax highlighting in async export, David Lukeš, 2022/10/03
- Re: Code block syntax highlighting in async export, Timothy, 2022/10/03
- Re: Code block syntax highlighting in async export, David Lukeš, 2022/10/03
- Re: Code block syntax highlighting in async export, Ihor Radchenko, 2022/10/03
- Re: Code block syntax highlighting in async export, Timothy, 2022/10/03
- Re: Code block syntax highlighting in async export, Ihor Radchenko, 2022/10/04
- Re: Code block syntax highlighting in async export, Timothy, 2022/10/04
- Re: Code block syntax highlighting in async export, Max Nikulin, 2022/10/03
- Re: Code block syntax highlighting in async export,
David Lukeš <=
- Re: Code block syntax highlighting in async export, Ihor Radchenko, 2022/10/04