A mermaid extension for odoc
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve odoc extensions and align docsite HTML with stock odoc

odoc-docsite:
- Rename CSS classes to align with stock odoc conventions
- Use odoc-nav, odoc-content, odoc-tocs for compatibility
- Prefix docsite-specific features with docsite-* (header, sidebar, etc.)
- Add class="odoc" to body element

odoc extensions:
- Add blocks_of_nestable_elements to extension API for preserving refs
- Fix admonition extension to render cross-references properly
- Fix MSC extension resource handling for nested module pages
- Fix Mermaid extension dark mode styling

Documentation:
- Improve JMAP docs with diagrams, admonitions, and better organization
- Fix IMAP state diagram (remove confusing logout from NotAuthenticated)
- Add JMAP dependency on ocaml-imap for cross-package references

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+14 -1
+14 -1
src/mermaid_extension.ml
··· 194 194 {|<div id="%s" class="odoc-mermaid-diagram"%s><pre class="mermaid">%s</pre></div>|} 195 195 id style_attr (html_escape content) 196 196 in 197 + (* Auto-detect dark mode and use appropriate theme *) 197 198 let init_script = Printf.sprintf {| 198 199 if (typeof window.mermaidInitialized === 'undefined') { 199 200 window.mermaidInitialized = true; 201 + var preferredTheme = '%s'; 202 + if (preferredTheme === 'default' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { 203 + preferredTheme = 'dark'; 204 + } 200 205 mermaid.initialize({ 201 206 startOnLoad: true, 202 - theme: '%s', 207 + theme: preferredTheme, 203 208 securityLevel: 'loose' 204 209 }); 205 210 } ··· 215 220 resources = [ 216 221 Api.Js_url mermaid_js_url; 217 222 Api.Js_inline init_script; 223 + Api.Css_url "extensions/mermaid.css"; 218 224 ]; 219 225 assets = []; 220 226 } ··· 239 245 240 246 .odoc-mermaid-error pre { 241 247 color: #c00; 248 + } 249 + 250 + /* Dark mode support */ 251 + @media (prefers-color-scheme: dark) { 252 + .odoc-mermaid-error pre { 253 + color: #fb4934; 254 + } 242 255 } 243 256 |} 244 257