Need AI Training/Help?CloudYeti.io/meet
MarkdownMe
Confluence wiki markup guide

Markdown Code Blocks to Confluence

Turn Markdown fenced code blocks into Confluence {code} macros with syntax highlighting, and know when to use {noformat} instead.

Direct answer

Markdown fenced code blocks become Confluence {code} macros: ```python turns into {code:language=python} ... {code}. The language after the fence maps to the macro's language parameter, which drives Confluence's syntax highlighting.

Open Markdown to Confluence converter

When to use this

  • Code snippets pasted into Confluence lost their formatting or highlighting.
  • Runbooks, API docs, or troubleshooting guides written in Markdown carry shell, Python, or JSON blocks.
  • You need Confluence's copy-button code macro instead of an indented plain-text blob.

Steps

  1. Tag every Markdown fence with a language (```bash, ```python, ```json) so highlighting survives.
  2. Convert the document — each fence becomes a {code:language=...} macro.
  3. Paste through Insert > Markup and confirm each block renders as a code macro, not a paragraph.
  4. Use {noformat} for output logs or config dumps where highlighting is noise.
  5. Preview long lines: the code macro scrolls horizontally instead of wrapping.

Example conversion

Markdown input
```python
def retry(fn, attempts=3):
    for i in range(attempts):
        try:
            return fn()
        except TimeoutError:
            continue
```
Confluence wiki output
{code:language=python}
def retry(fn, attempts=3):
    for i in range(attempts):
        try:
            return fn()
        except TimeoutError:
            continue
{code}

Common mistakes

  • Do not leave fences untagged — {code} without a language renders but loses syntax highlighting.
  • Do not use inline backticks for multi-line code; they become {{monospace}} text, not a code block.
  • Do not nest a code fence inside a blockquote and expect both to survive — convert them separately.

FAQ

Which languages does the Confluence code macro highlight?
Common ones include bash, python, java, javascript, sql, xml, yaml, and json. If a language is not supported, the macro still renders the block as monospaced code without coloring.
What is the difference between {code} and {noformat}?
{code} adds syntax highlighting and a language label; {noformat} renders raw preformatted text with no highlighting. Use {noformat} for logs, diffs, and terminal output.
How does inline Markdown code convert?
Inline backticks like `npm install` become Confluence {{npm install}} monospace text, which renders inline rather than as a block.
Why does my pasted code block show literal ``` characters?
Confluence does not understand Markdown fences. Until they are converted to {code} macros, the backticks are just text — run the document through the converter first.

Related Confluence guides