xsl-list
[Top] [All Lists]

Re: [xsl] Highlight.js available as a XPath extension function

2020-07-03 02:20:39
Christophe Marchand cmarchand(_at_)oxiane(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> writes:
which is not yet open-sourced - I wanted to use exactly the same
highlighter...

Yes. I faced exactly the same problem. I had been using PrismJS for
syntax highlighting in the browser, but I needed to be able to produce
PDFs. It was annoying that the PDFs weren’t syntax highlighted.

I’ve tinkered with calling JavaScript from the JVM (I have a
cx:javascript step), but at a glance, it didn’t seem practical to run
Prism in that context (does highlightJS really not use any of the DOM
APIs? Or does GraalsJS now support them?)

I cooked up an XProc pipeline to use Pygments in the PDF toolchain, but
then the PDFs had different syntax highlighting than the browser :-(

For the DocBook xslTNG stylesheets, I just went with Pygments in both
places. And since I’m (temporarily!) getting by without an XProc
implementation in that context, I coded it up as an extension function.

I’ve also now coded up a proper XInclude implementation as an extension
function and a RELAX NG validator. [Expletive] pipelines are useful and
being without them is damned inconvenient!

You complain about forking processes, but embedding a GraalJS engine

Right. I had seen your note about GraalJS being kind of heavyweight and
I didn’t want to give the impression that Pygments was going to be
faster!

I’ll try to get your extension working too.

                                        Be seeing you,
                                          norm

--
Norman Tovey-Walsh <ndw(_at_)nwalsh(_dot_)com>
https://nwalsh.com/

She was mostly immensely relieved to think that virtually everything
that anybody had ever told her was wrong. (Mrs. E. Kapelsen)--Douglas
Adams
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

Attachment: signature.asc
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>