Prism.js

Last modified by superadmin on 2026/11/25 21:28

Code snippets colored by the browser when the page is displayed, in any language Prism.js supports.

Explanation

The Prism.js Macro highlights code snippets in wiki pages using Prism.js: you insert a "prism" macro where the code goes and give its language, and its parameters also add line numbers or read the code from a script variable.

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.

Prism.js Macro 1.3+ 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.

The bundled Code Macro highlights code on the server instead. An administrator can make the Code Macro use Prism.js, so that existing code macros are highlighted the same way.

More

To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.

Related

Get Connected