Get the high-level details you need to set up your Confluence Cloud site in order to meet your team's needs.
Learn how to create great content and organize it.
Learn how to collaborate on pages and blogs, get notified about activity, and view analytics to see how content is performing.
Adjust settings around who can see what content on your site and what actions they can perform on it.
Find everything a site admin needs to know to keep their Confluence Cloud site running smoothly.
Get an overview of all the ways you can extend your Confluence content using macros and gadgets.
This macro was intentionally excluded from the new editor and replaced with the Code Snippet element. Learn more
The Code Block macro allows you to display source code in your page with syntax highlighting, like the one below:
Use the Code Block macro
To add the Code Block macro:
When editing, select from the toolbar
Find the macro by name and select it
Configure it as needed
You can also type / on the page to bring up the same list you'd see by selecting from the toolbar. Continue typing the name of the macro to filter the list.
To edit the Code Block macro:
Select the macro placeholder.
Select the Edit icon to open the configuration panel.
Configure the parameters. Your changes are saved as you go.
Resume editing the page, and the panel closes.
You can also select the centered , medium-width , and full-width icons to adjust the width of some macros. Select the trashcan iconto remove the macro.
You type the code block directly into the macro placeholder in the editor. Note that any white space contained in the placeholder is not manipulated in any way by the Code Block macro. This is to provide the writer with flexibility over code indentation.
Parameters are options that you can set to control what and how content from the macro appears on the page.
If the parameter name used in Confluence Cloud storage format or wikimarkup is different than the label used when inserting macros using the browser or the slash command, it will be listed below in brackets (example).
Specifies the language (or environment) for syntax highlighting. The default language is Java but you can choose from one of the following languages/environments:
Adds a title to the code block. If specified, the title will be displayed in a header row at the top of the code block.
If selected, the code macro's content will be collapsed upon visiting or refreshing the Confluence page. Clicking the expand source link allows you to view this content. If false, the code macro's content is always displayed in full.
Show line numbers
If selected, line numbers will be shown to the left of the lines of code.
First line number
When Show line numbers is selected, this value defines the number of the first line of code.
Specifies the color scheme used for displaying your code block. Many of these themes are based on the default color schemes of popular integrated development environments (IDEs). The default theme is Confluence (also known as Default), which is typically black and colored text on a blank background. However, you can also choose from one of the following other popular themes:
Wiki markup example
Wiki markup is only supported in the legacy editor.
Wiki markup is useful when you need to add a macro outside the editor, for example as custom content in the sidebar, header or footer of a space.
Macro name: code
Macro body: Accepts plain text.
Was this helpful?