emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "David Lukeš" <dafydd.lukes@gmail.com>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Code block syntax highlighting in async export
Date: Mon, 3 Oct 2022 21:32:27 +0200	[thread overview]
Message-ID: <CAEPTPEwX1x8eqc9bMkuDw1AXFkwKeiw172E=2T4LNoyymPkuDQ@mail.gmail.com> (raw)
In-Reply-To: <a8932050-ef0b-1ff0-9bb2-7c73d9344265@gmail.com>

> 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


  reply	other threads:[~2022-10-03 20:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02  3:24 Code block syntax highlighting in async export David Lukeš
2022-10-02  7:24 ` Ihor Radchenko
2022-10-02 12:13   ` Max Nikulin
2022-10-03 12:08     ` David Lukeš
2022-10-03 12:42       ` Timothy
2022-10-03 13:22         ` David Lukeš
2022-10-03 13:58           ` Ihor Radchenko
2022-10-03 14:40             ` Timothy
2022-10-04  4:10               ` Ihor Radchenko
2022-10-04  4:14                 ` Timothy
2022-10-03 15:57       ` Max Nikulin
2022-10-03 19:32         ` David Lukeš [this message]
2022-10-04  4:04       ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEPTPEwX1x8eqc9bMkuDw1AXFkwKeiw172E=2T4LNoyymPkuDQ@mail.gmail.com' \
    --to=dafydd.lukes@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).