How to Fix Confluence Expand Macro Not Working
In this tutorial, you'll learn about How to Fix Confluence Expand Macro Not Working. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
The Confluence expand macro shows a gray box with no toggle, content is hidden but cannot be expanded, or the macro does not render. Storage format issues cause this.
The Wrong Way
// Nesting expand macros inside each other
[expand]
[expand]
[expand]deep content[/expand]
[/expand]
[/expand]
Nested expand macros break Confluence's parser. The inner macros do not render.
The Right Way
Step 1: Use the expand macro correctly
# In the editor: /expand → select "Expand" macro
# Give it a title: "View Details"
# Add content inside the expand body
Step 2: Check the macro body
# View → Storage Format
# Valid expand macro:
# <ac:structured-macro ac:name="expand">
# <ac:parameter ac:name="title">Click to expand</ac:parameter>
# <ac:rich-text-body>
# <p>Hidden content here</p>
# </ac:rich-text-body>
# </ac:structured-macro>
If the storage format has unclosed tags or missing body, the macro breaks.
Step 3: Remove nested expands
# Confluence does not support expand-inside-expand
# Workaround: use a single expand with headings inside
# Or use the "Details" summary macro for sub-sections
Step 4: Clear cache and retry
# Confluence Admin → Cache Management → Flush cache
# Or add a space at the end of the content and save again
# Sometimes trailing whitespace triggers re-render
Expand macro "Implementation Details" toggles correctly — 3 paragraphs hidden, reveal on click.
Prevention
- Do not nest expand macros — use a single expand with headings for structure.
- Keep expand titles short (under 50 characters) for the toggle button to display fully.
- The toggle pattern is the same as Doda Browser's collapsible developer toolbar — clean toggling without nested conflicts.
Common Mistakes with expand macro
- Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
- Using
headandtailinstead of pattern matching, causing runtime errors on empty lists - Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
These mistakes appear frequently in real-world CONFLUENCE code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro