Subject: [xsl] Highlight.js available as a XPath extension function From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 2 Jul 2020 21:21:30 -0000 |
Highlight JS is a well known javascript library that is able to highlight source code in a HTML page. If you need to generate a static HTML that contains highlighted source code, and if you use Saxon 10 and Java 11 at least, you now have a XPath extension function that do this. It embeds highlight.js library, and so, rendering is the same as the one done in browser. But your page is generated and do not require JavaScript, and so can be used as source in multiple renderers, as FlyingSaucer[0] or forks. highlightJS-saxon-extension is available in maven <https://repo1.maven.org/maven2/top/marchand/xml/saxon/extension/highlight/1.00.01/>[1], and source code is on github <https://github.com/cmarchand/highligtJS-saxon-extension>[2]. A XSL sample is available in unit tests : https://github.com/cmarchand/highligtJS-saxon-extension/blob/master/src/test/xsl/top/marchand/xml/saxon/extension/highlight/formater.xsl[3] with data <https://github.com/cmarchand/highligtJS-saxon-extension/blob/master/src/test/xml/top/marchand/xml/saxon/extension/highlight/source-code.xml>[4], and java samples <https://github.com/cmarchand/highligtJS-saxon-extension/blob/master/src/test/java/top/marchand/xml/saxon/extension/highlight/HighlightExtensionTest.java#L60>[5] to configure Saxon are available. Enjoy, Christophe [0] : https://github.com/flyingsaucerproject/flyingsaucer [1] : https://repo1.maven.org/maven2/top/marchand/xml/saxon/extension/highlight/1.00.01/ [2] : https://github.com/cmarchand/highligtJS-saxon-extension/ [3] : https://github.com/cmarchand/highligtJS-saxon-extension/blob/master/src/test/xsl/top/marchand/xml/saxon/extension/highlight/formater.xsl [4] : https://github.com/cmarchand/highligtJS-saxon-extension/blob/master/src/test/xml/top/marchand/xml/saxon/extension/highlight/source-code.xml [5] : https://github.com/cmarchand/highligtJS-saxon-extension/blob/master/src/test/java/top/marchand/xml/saxon/extension/highlight/HighlightExtensionTest.java#L60
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [ANN] Balisage: The Markup Co, B Tommie Usdin btusd | Thread | Re: [xsl] Highlight.js available as, Martin Honnen martin |
[xsl] [ANN] Balisage: The Markup Co, B Tommie Usdin btusd | Date | Re: [xsl] Highlight.js available as, Martin Honnen martin |
Month |