Admonitions 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>

+79 -15
+79 -15
src/admonition_extension.ml
··· 14 14 (** CSS styles for admonitions - registered as a support file *) 15 15 let admonition_css = {| 16 16 /* Admonition extension styles */ 17 + 18 + /* Reset the parent ul to align with content flow */ 19 + .at-tags:has(li[class^="admonition"]) { 20 + margin-left: 0; 21 + } 22 + 23 + /* Style the outer container */ 24 + .at-tags li[class^="admonition"] { 25 + padding: 0.875em 1em; 26 + margin: 1em 0; 27 + border-left: 3px solid; 28 + border-radius: 2px; 29 + text-indent: 0; 30 + padding-left: 1em; 31 + list-style: none; 32 + } 33 + 34 + /* Remove duplicate styling from inner paragraphs */ 17 35 .admonition-note, .admonition-warning, .admonition-tip, .admonition-important { 18 - padding: 1em; 19 - margin: 1em 0; 20 - border-left: 4px solid; 21 - border-radius: 4px; 36 + padding: 0; 37 + margin: 0; 38 + border: none; 39 + background: transparent; 40 + } 41 + 42 + /* Container colors - light mode */ 43 + .at-tags li[class^="admonition"][class*="note"], 44 + .at-tags li[class="admonition"] { 45 + border-color: #1976D2; 46 + background: #F5F9FD; 47 + color: #1565C0; 48 + } 49 + .at-tags li[class*="warning"] { 50 + border-color: #EF6C00; 51 + background: #FFF8F0; 52 + color: #E65100; 22 53 } 23 - .admonition-note { border-color: #2196F3; background: #E3F2FD; } 24 - .admonition-warning { border-color: #FF9800; background: #FFF3E0; } 25 - .admonition-tip { border-color: #4CAF50; background: #E8F5E9; } 26 - .admonition-important { border-color: #F44336; background: #FFEBEE; } 27 - .admonition-label { font-weight: bold; margin-bottom: 0.5em; } 54 + .at-tags li[class*="tip"] { 55 + border-color: #2E7D32; 56 + background: #F5FAF5; 57 + color: #1B5E20; 58 + } 59 + .at-tags li[class*="important"] { 60 + border-color: #C62828; 61 + background: #FDF5F5; 62 + color: #B71C1C; 63 + } 64 + 65 + .admonition-label { 66 + font-weight: 600; 67 + margin-bottom: 0.25em; 68 + display: block; 69 + letter-spacing: 0.01em; 70 + } 71 + 72 + /* Dark mode support */ 73 + @media (prefers-color-scheme: dark) { 74 + .at-tags li[class^="admonition"][class*="note"], 75 + .at-tags li[class="admonition"] { 76 + border-color: #64B5F6; 77 + background: rgba(33, 150, 243, 0.08); 78 + color: #90CAF9; 79 + } 80 + .at-tags li[class*="warning"] { 81 + border-color: #FFB74D; 82 + background: rgba(255, 152, 0, 0.08); 83 + color: #FFCC80; 84 + } 85 + .at-tags li[class*="tip"] { 86 + border-color: #81C784; 87 + background: rgba(76, 175, 80, 0.08); 88 + color: #A5D6A7; 89 + } 90 + .at-tags li[class*="important"] { 91 + border-color: #E57373; 92 + background: rgba(244, 67, 54, 0.08); 93 + color: #EF9A9A; 94 + } 95 + } 28 96 |} 29 97 30 98 (** Map tag variants to admonition types *) ··· 49 117 | Tip -> "Tip" 50 118 | Important -> "Important" 51 119 52 - (** Convert comment content to Block.t *) 120 + (** Convert comment content to Block.t, preserving references and formatting *) 53 121 let content_to_blocks content = 54 - let text = text_of_nestable_block_elements content in 55 - if String.length text = 0 then 56 - [] 57 - else 58 - paragraph text 122 + blocks_of_nestable_elements content 59 123 60 124 (** Document phase - wrap content in styled admonition block *) 61 125 let to_document ~tag content =