Wiki source code of Prism.js

Last modified by Vincent Massol on 2026/10/20 18:45

Show last authors
1 The [[Prism.js Macro>>doc:extensions:Extension.PrismJS.PrismMacro.WebHome]] highlights code snippets in wiki pages using [[Prism.js>>https://prismjs.com/]]. To use it, see [[Highlight Code in a Page>>doc:documentation.extensions.user.prismjs.highlight-code.WebHome]] and the [["prism" macro>>doc:documentation.extensions.user.prismjs.prism-macro.WebHome]] reference.
2
3 The highlighting is done by the browser, not by the wiki: the page holds the plain code, and Prism.js colors it when the page is displayed. The grammar of each language is loaded only when a page uses it, so any language Prism.js supports works without configuration. Code is also highlighted when editing the page in place with the WYSIWYG editor, but not in the standalone WYSIWYG editor.
4
5 {{version product="Prism.js Macro" since="1.3"}}
6 The colors are a variant of the default Prism.js theme, darkened so that all highlighted text meets the WCAG AA contrast ratio of 4.5:1.
7 {{/version}}
8
9 The bundled [[Code Macro>>doc:extensions:Extension.Code Macro.WebHome]] highlights code on the server instead. An administrator can [[make the Code Macro use Prism.js>>doc:documentation.extensions.admin.prismjs.replace-code-macro.WebHome]], so that existing ##code## macros are highlighted the same way.

Get Connected