Nice wiki speed up for syntax highlighting

Ilmari Lauhakangas ilmari.lauhakangas at libreoffice.org
Wed Mar 2 12:44:37 UTC 2022


As I was experimenting with the Developer Guide, we noticed unusually 
slow load times with its merged First Steps chapter. Guilhem looked into 
it and discovered the Python based syntax highlighting utility was 
spawning new shells for each code block like some kind of lunatic! 
Guilhem tested another MediaWiki extension based on highlight.js, but it 
had issues and is not actively maintained.

Luckily, I found a nice extension written by Scratch contributor 
apple502j: 
https://github.com/InternationalScratchWiki/SyntaxHighlight_PrismJS

It uses prism.js: https://prismjs.com/

It was tested in our testwiki and is now deployed in production. The 
load time of the dev guide First Steps chapter is like 50x faster now.

The chapter in question: 
https://wiki.documentfoundation.org/Documentation/DevGuide/First_Steps

Ilmari


More information about the LibreOffice mailing list