[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ANN: Pygments support for LilyPond

From: Jean Abou Samra
Subject: Re: ANN: Pygments support for LilyPond
Date: Mon, 22 Nov 2021 19:42:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

Thanks.  Please apply the attached patch to `texinfo.tex` to make
`@setcolor` work in `@example` environments; it is necessary to
temporarily make a space character behave normally.

If my solution is sufficient I will submit it to texinfo upstream.

Thanks a lot! I'll test it as soon as possible.

Am Montag, dem 22.11.2021 um 04:12 +0100 schrieb Jean Abou Samra:
So the next step now would be adding syntax highlighting to
the documentation. I've managed a prototype for HTML fairly
easily, and Info doesn't know about colors, so that's easy.
What about PDF, however? Texinfo itself doesn't seem to have
commands for changing colors. The packages that I could find
(color, xcolor, fancyvrb) were all for LaTeX, not plain TeX.
What do the Texinfo and TeX experts in the room (looking at
Werner and David) think about the issue? Is there a way to
get highlighting in PDF without too much pain? Is it even
desirable from a stylistic point of view?
FWIW I'm not very enthusiastic about adding another dependency to the
already complex documentation build setup.

The plan is an optional dependency (--enable-pygments
configure flag). I don't think a hard dependency would
be reasonable at this point given that the lexer has
not yet made it to an official Pygments release (it's
in master since yesterday).

However, it's also an option to include Pygments in
our source tree waiting for the upcoming release
to percolate in distributions. Would you consider
that preferable?

In addition, your mention of
HTML in particular makes me fear that it is implemented in lilypond-
texi2html.init - making us even more dependent on texi2html which we
should really move away from in favor of plain texi2any...

No, I'm trying to implement it in lilypond-book
as an internal option. That's much simpler because
all the infrastructure to run Python code is
already there, and we can just 'import pygments'
to access the API. It's also quite necessary to have
all snippets highlighted in a single run of the Python
interpreter because the time to fire up CPython is
something like 0.05s which would mean several minutes
spent just in Python startup time given the number
of snippets. In contrast, timeit tells me that
highlighting all snippets in one go should not take
more than 10 seconds in total.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]