On this page
Overview
The Code Pro macro extends the native code macro. The following features are included:
- Source code can be from any of these sources:
- Within your Confluence page (same as the code macro).
- From an external URL. For example: Bitbucket, GitHub, or Stash.
- From a file residing on the Confluence server. For example, a clone of a Git or Mercurial repository.
- From a page attachment.
- From a global or space template.
- Syntax highlighting equivalent to code macro. Recognizes the same language extensions added to the code macro.
- Supports all the current code macro parameters.
- Subset by line number or regex selection - see Sections parameter. Allows showing one or more sections of code from the same source.
- Expand and collapse support similar to the expand macro. Option to show or collapse on initial display.
- Automatic title generation from the file or path name.
- Profiles allow administrators to pre-configure access to repositories and hide access credentials.
- Enabled for Macro Security for Confluence to allow control of url and profile parameters. See Macro Security Managed Macros.
Under the covers
After retrieving the source code from the various sources, the code macro is then used under the covers. This means behavior will be equivalent to existing code macro behavior! The native code macro must be enabled (the default).
Basic use
This macro can be deployed using one of the following methods:
Selected from the Macro Browser | code-pro |
---|---|
Markup Shortcut | {code-pro} |
Screenshot
Parameters
Click a column heading to toggle the sorting of that column.
Examples
You can get source from virtually any repository or other source of data provided they provide a url link to the raw source text (as if you were downloading the source file). Here are just a few examples.