Paste Code Macro

Last modified by Jim Bach on 2026/07/01 12:24

Description

The Code Paste macro is a bridge between Confluence and XWiki's Code macro. The aim of this macro is to allow users to paste code snippets in the page.

Parameters

ParameterDescription
languageThe code language to be used for the representation.
titleThe title of the box containing the code.

Example of usage

{{paste-code-macro language="java" title="Hello World Example"}}
class Simple{
    public static void main(String args[]){
        System.out.println("Hello World !");
    }
}
{{/paste-code-macro}}

With the following result :

Failed to execute the [include] macro. Cause: [Current user [null] doesn't have view rights on document [xwiki:Licenses.Code.VelocityMacros]]. Click on this message for details.

Hello World Example

class Simple{
   public static void main(String args[]){
        System.out.println("Hello Java");
   }
}