As someone who frequently documents Python and Bash scripts in Confluence, I've come to really appreciate the Code Snippet element in the new editor.
It makes technical documentation so much cleaner and more readable.
After using it extensively for my own runbooks and automation scripts, I thought I'd share some practical tips and best practices that might help others get the most out of this feature.
/code
on a new line+
symbol in the toolbarCtrl/Cmd + Shift + M
The Code Snippet element supports syntax highlighting for many languages:
Backend:
Frontend:
DevOps & Scripting:
Others:
💡 Tip: The language is often detected automatically. However, you can also set it manually via the dropdown menu in the code block.
1. Set Language Explicitly
2. Short, Focused Snippets
3. Add Context

Always add a brief explanation BEFORE the code.
4. Use Line Numbers
Example: REST API Endpoint
Response
Problem: Service won't start
Solution:
Docker Compose Setup:
Always specify which version the code is for:
ℹ️ Note: This code works with Python 3.9+
Link to official documentation:
Use comments for explanations:
Solution: Make sure you're using the Code Snippet element, not normal text with monospace font.
Solution: Select the language manually from the dropdown menu.
Solution:
Action | Shortcut |
---|---|
Insert Code Snippet | /code |
Convert text to code | Ctrl/Cmd + Shift + M |
Change language | Click dropdown in block |
Copy code | Hover → Copy button |
✅ Code Snippet Element = Professional code presentation
✅ Syntax highlighting for 20+ languages
✅ Perfect for API docs, runbooks, how-tos
✅ Keyboard shortcuts save time
Are you already using Code Snippets? Share your tips in the comments!
Kai Krause
Senior Technical Consultant
VI2VA
Brunswick
52 accepted answers
0 comments