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 converterWhen 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
- Tag every Markdown fence with a language (```bash, ```python, ```json) so highlighting survives.
- Convert the document — each fence becomes a {code:language=...} macro.
- Paste through Insert > Markup and confirm each block renders as a code macro, not a paragraph.
- Use {noformat} for output logs or config dumps where highlighting is noise.
- Preview long lines: the code macro scrolls horizontally instead of wrapping.
Example conversion
```python
def retry(fn, attempts=3):
for i in range(attempts):
try:
return fn()
except TimeoutError:
continue
```{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
Markdown Runbook to Confluence
Convert a Markdown runbook into Confluence wiki markup with steps, warnings, code blocks, and rollback notes.
Confluence Technical Spec Template
Format a Markdown technical spec for Confluence with problem, decision, architecture, tradeoffs, and open questions.
Markdown Incident Review to Confluence
Convert a Markdown incident review into a Confluence page with timeline, impact, root cause, and follow-up actions.
Markdown Meeting Notes to Confluence
Turn Markdown meeting notes into a Confluence page with decisions, action items, blockers, and links.
Paste Markdown into Confluence (Without Broken Formatting)
Convert the Markdown to Confluence wiki markup, then paste it through Insert > Markup. That is the only way headings, tables, and code blocks survive. Raw Markdown pastes as plain text.
Markdown Table to Confluence
Convert Markdown pipe tables into Confluence wiki markup tables with proper header rows, and avoid the collapses that happen when you paste tables directly.
Markdown Checklists to Confluence
Convert Markdown task lists (- [ ] and - [x]) into Confluence-friendly checklists using (/) and (x) status icons, or the editor's action items.
Reading for wiki and docs work
How to structure a Confluence space, and how to write the pages that go in it.
Implementing Atlassian Confluence
How to set up Confluence for a distributed team: space structure, page templates, and permissions that hold up as the wiki grows.
- Space and page structure
- Templates and permissions
- Distributed team collaboration
- Pairs with the Markdown to Confluence tool
Handbook of Technical Writing (10th ed.)
The desk reference for technical documentation. You look entries up mid-draft instead of reading it front to back.
- Alphabetical reference format
- Usage, grammar, and document types
- Tenth edition
- For docs, specs, and release notes
Technical Writing Process
A five-step method for user guides, manuals, and procedures. It is written for people who write docs without a docs job title.
- Five-step process
- User guides, manuals, procedures
- Plan, structure, draft, review, publish
- No prior technical-writing training assumed
Amazon affiliate links. We earn a commission on qualifying purchases at no extra cost to you.