Replace the Code Macro with Prism.js

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

This documentation is about the Prism.js Code Macro Replacement extension.

Install & versions

Make every existing code macro highlight with Prism.js by installing one extension.

Steps

  1. Go to "Administration > Extensions", search for the Prism.js Code Macro Replacement extension and click "Install". The Prism.js Macro is installed with it.
  2. Select "Installed extensions" and search for prism: Prism.js Code Macro Replacement is listed as "Installed".

    Installed extensions list with Prism.js Code Macro Replacement highlighted

  3. Open a page that holds a code macro. Its code is now highlighted by Prism.js.

    Code macro with line numbers highlighted by Prism.js

FAQ

Which Code Macro parameters are kept?

language, layout and source work as with the "prism" macro. The title, image, cssClass and width parameters are ignored, and code without a language is displayed without highlighting.

How do I go back to the Code Macro?

Uninstall Prism.js Code Macro Replacement from "Administration > Extensions", then restart XWiki.

Related

Get Connected