Highlight Code in a Page

Last modified by Vincent Massol on 2026/10/20 16:30

Steps

Display a code snippet with syntax highlighting in a wiki page, using the "prism" macro.

  1. Edit the page and insert the "Prism" macro where the code goes.
  2. Paste the code in "Content", enter its language identifier in "Language" (for example java), optionally select "Linenumbers" in "Layout", and click "Submit".

    Prism macro dialog with the Language field set to java and the Layout field set to Linenumbers highlighted

    In the wiki editor, write the macro on its own lines instead:

    {{prism language="java" layout="linenumbers"}}
    @Component
    @Named("prism")
    @Singleton
    public class PrismMacro extends AbstractMacro<PrismMacroParameters>
    {
    }
    {{/prism}}
  3. Click "Save & View". The code is displayed highlighted, with line numbers when you selected them.

    Java code block highlighted by Prism.js with line numbers

FAQ

Which language identifiers can I use?

See the language parameter of the "prism" macro.

How do I highlight code inside a sentence?

Write the macro on the same line as the surrounding text: see the inline mode of the "prism" macro.

Related

Get Connected