Code blocks in Confluence — Performance & Best Practices
· One min read
Q: Do large code blocks slow pages? A: Very large code blocks can increase DOM size; use collapsed blocks or pagination for long code.
Q: Monaco editor impact? A: Monaco is feature-rich and heavier; use client-side loading and lazy-init to reduce initial load.
Q: Syntax highlighting for many languages? A: Load only required language components when possible; avoid bundling all languages in the client.
Q: Search within code blocks? A: Monaco supports find/replace; for static pages, consider server-side search indexing of code snippets.
Q: Accessibility? A: Provide a plain-text downloadable file and ensure proper contrast for themes.
Q: Exporting code? A: Provide copy buttons and export to raw text for easier reuse.