apex-ruby 1.0.18 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -3
  3. data/ext/apex_ext/apex_ext.c +260 -91
  4. data/ext/apex_ext/apex_src/CHANGELOG.md +440 -0
  5. data/ext/apex_ext/apex_src/CMakeLists.txt +15 -1
  6. data/ext/apex_ext/apex_src/Formula/apex.rb +7 -2
  7. data/ext/apex_ext/apex_src/Package.swift +15 -4
  8. data/ext/apex_ext/apex_src/README.md +94 -35
  9. data/ext/apex_ext/apex_src/VERSION +1 -1
  10. data/ext/apex_ext/apex_src/apex-debug.log +4 -0
  11. data/ext/apex_ext/apex_src/apex.code-workspace +38 -0
  12. data/ext/apex_ext/apex_src/apex.taskpaper +12 -0
  13. data/ext/apex_ext/apex_src/apex_deflist_debug.log +25 -0
  14. data/ext/apex_ext/apex_src/buildnotes.md +1435 -0
  15. data/ext/apex_ext/apex_src/cli/main.c +262 -33
  16. data/ext/apex_ext/apex_src/debug.log +7 -0
  17. data/ext/apex_ext/apex_src/docs/CITATIONS_EXAMPLES.md +274 -0
  18. data/ext/apex_ext/apex_src/docs/CITATIONS_IMPLEMENTATION_PLAN.md +749 -0
  19. data/ext/apex_ext/apex_src/docs/CITATIONS_PLAN.md +744 -0
  20. data/ext/apex_ext/apex_src/docs/INDEX_IMPLEMENTATION_ANALYSIS.md +382 -0
  21. data/ext/apex_ext/apex_src/docs/plans/2025-02-27-man-page-output-implementation.md +351 -0
  22. data/ext/apex_ext/apex_src/docs/superpowers/plans/2026-07-12-toc-output-format.md +745 -0
  23. data/ext/apex_ext/apex_src/docs/superpowers/plans/2026-07-18-bear-image-attributes.md +829 -0
  24. data/ext/apex_ext/apex_src/docs/superpowers/plans/2026-07-19-apex-node-npm.md +1148 -0
  25. data/ext/apex_ext/apex_src/docs/superpowers/specs/2026-07-12-toc-output-format-design.md +161 -0
  26. data/ext/apex_ext/apex_src/docs/superpowers/specs/2026-07-18-bear-image-attributes-design.md +184 -0
  27. data/ext/apex_ext/apex_src/docs/superpowers/specs/2026-07-19-apex-node-npm-design.md +211 -0
  28. data/ext/apex_ext/apex_src/documentation/app-settings-table.md +67 -0
  29. data/ext/apex_ext/apex_src/documentation/app-transformed/Citations.md +340 -0
  30. data/ext/apex_ext/apex_src/documentation/app-transformed/Credits.md +11 -0
  31. data/ext/apex_ext/apex_src/documentation/app-transformed/Header-IDs.md +234 -0
  32. data/ext/apex_ext/apex_src/documentation/app-transformed/Inline-Attribute-Lists.md +516 -0
  33. data/ext/apex_ext/apex_src/documentation/app-transformed/Metadata-Transforms.md +461 -0
  34. data/ext/apex_ext/apex_src/documentation/app-transformed/Modes.md +193 -0
  35. data/ext/apex_ext/apex_src/documentation/app-transformed/Multi-File-Documents.md +201 -0
  36. data/ext/apex_ext/apex_src/documentation/app-transformed/Plugins.md +678 -0
  37. data/ext/apex_ext/apex_src/documentation/app-transformed/Syntax.md +1367 -0
  38. data/ext/apex_ext/apex_src/documentation/docsets/Apex Command Line Options.cheatsheet.txt +6 -0
  39. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/C-API.html +774 -300
  40. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Callouts.html +1194 -0
  41. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Citations.html +416 -216
  42. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Command-Line-Options.html +3544 -1094
  43. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Configuration.html +371 -97
  44. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Credits.html +153 -23
  45. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Examples.html +358 -124
  46. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Filters.html +1656 -0
  47. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Generating-Man-Pages.html +1226 -0
  48. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Getting-Started.html +201 -56
  49. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Header-IDs.html +279 -109
  50. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Home.html +200 -53
  51. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Indices.html +2327 -0
  52. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Inline-Attribute-Lists.html +690 -271
  53. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Installation.html +201 -55
  54. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Limitations-and-Roadmap.html +238 -68
  55. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Metadata-Transforms.html +421 -221
  56. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Modes.html +340 -78
  57. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Multi-File-Documents.html +251 -86
  58. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Multi-Format-Images.html +1362 -0
  59. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Pandoc-Integration.html +277 -90
  60. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Plugins.html +673 -346
  61. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Quarto-Mode.html +1405 -0
  62. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Rendering-Markdown-In-Terminal.html +1902 -0
  63. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Syntax.html +1939 -1698
  64. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Tables.html +1781 -0
  65. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Troubleshooting.html +315 -140
  66. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Usage.html +307 -113
  67. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Using-Apex-with-Jekyll.html +1132 -0
  68. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Writing-Tests.html +1754 -0
  69. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Xcode-Integration.html +872 -376
  70. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/docSet.dsidx +0 -0
  71. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
  72. data/ext/apex_ext/apex_src/documentation/html/apex-app-docs.html +8746 -0
  73. data/ext/apex_ext/apex_src/documentation/shared_styles.css +20 -15
  74. data/ext/apex_ext/apex_src/documentation/transform_for_app.md +55 -0
  75. data/ext/apex_ext/apex_src/escaping-repro.md +103 -0
  76. data/ext/apex_ext/apex_src/examples/quick-actions/Markdown to RTF.workflow/Contents/Info.plist +8 -0
  77. data/ext/apex_ext/apex_src/examples/quick-actions/Markdown to RTF.workflow/Contents/QuickLook/Preview.png +0 -0
  78. data/ext/apex_ext/apex_src/examples/quick-actions/Markdown to RTF.workflow/Contents/document.wflow +547 -0
  79. data/ext/apex_ext/apex_src/examples/quick-actions/Markdown-to-RTF.workflow.zip +0 -0
  80. data/ext/apex_ext/apex_src/examples/quick-actions/README.md +33 -0
  81. data/ext/apex_ext/apex_src/include/apex/apex.h +92 -6
  82. data/ext/apex_ext/apex_src/include/apex/ast_rtf.h +23 -0
  83. data/ext/apex_ext/apex_src/include/apex/ast_terminal.h +6 -0
  84. data/ext/apex_ext/apex_src/include/apex/module.modulemap +5 -0
  85. data/ext/apex_ext/apex_src/include/apex/plugins.h +105 -0
  86. data/ext/apex_ext/apex_src/include/apexc.h +1 -0
  87. data/ext/apex_ext/apex_src/man/apex.1 +82 -78
  88. data/ext/apex_ext/apex_src/man/apex.1.md +81 -4
  89. data/ext/apex_ext/apex_src/objc/Apex.swift +73 -0
  90. data/ext/apex_ext/apex_src/objc/ApexPlugins.swift +79 -0
  91. data/ext/apex_ext/apex_src/objc/NSString+Apex.h +83 -5
  92. data/ext/apex_ext/apex_src/objc/NSString+Apex.m +244 -1
  93. data/ext/apex_ext/apex_src/objc/NSString+ApexPlugins.h +76 -0
  94. data/ext/apex_ext/apex_src/objc/NSString+ApexPlugins.m +169 -0
  95. data/ext/apex_ext/apex_src/output.html +87 -0
  96. data/ext/apex_ext/apex_src/plans/quarto-mode.md +442 -0
  97. data/ext/apex_ext/apex_src/src/_README.md +85 -32
  98. data/ext/apex_ext/apex_src/src/apex.c +770 -200
  99. data/ext/apex_ext/apex_src/src/ast_rtf.c +848 -0
  100. data/ext/apex_ext/apex_src/src/ast_terminal.c +184 -7
  101. data/ext/apex_ext/apex_src/src/extensions/abbreviations.c +10 -3
  102. data/ext/apex_ext/apex_src/src/extensions/advanced_tables.c +7 -11
  103. data/ext/apex_ext/apex_src/src/extensions/bear_image_attrs.c +467 -0
  104. data/ext/apex_ext/apex_src/src/extensions/bear_image_attrs.h +27 -0
  105. data/ext/apex_ext/apex_src/src/extensions/callouts.c +400 -4
  106. data/ext/apex_ext/apex_src/src/extensions/callouts.h +15 -5
  107. data/ext/apex_ext/apex_src/src/extensions/citations.c +26 -5
  108. data/ext/apex_ext/apex_src/src/extensions/code_fence_attrs.c +632 -0
  109. data/ext/apex_ext/apex_src/src/extensions/code_fence_attrs.h +22 -0
  110. data/ext/apex_ext/apex_src/src/extensions/concordance.c +632 -0
  111. data/ext/apex_ext/apex_src/src/extensions/definition_list.c +129 -15
  112. data/ext/apex_ext/apex_src/src/extensions/grid_tables.c +1050 -121
  113. data/ext/apex_ext/apex_src/src/extensions/html_markdown.c +569 -16
  114. data/ext/apex_ext/apex_src/src/extensions/ial.c +502 -52
  115. data/ext/apex_ext/apex_src/src/extensions/ial.h +2 -1
  116. data/ext/apex_ext/apex_src/src/extensions/includes.c +532 -33
  117. data/ext/apex_ext/apex_src/src/extensions/includes.h +7 -1
  118. data/ext/apex_ext/apex_src/src/extensions/index.c +1427 -140
  119. data/ext/apex_ext/apex_src/src/extensions/index.h +28 -0
  120. data/ext/apex_ext/apex_src/src/extensions/metadata.c +200 -161
  121. data/ext/apex_ext/apex_src/src/extensions/quarto_diagrams.c +251 -0
  122. data/ext/apex_ext/apex_src/src/extensions/quarto_diagrams.h +22 -0
  123. data/ext/apex_ext/apex_src/src/extensions/quarto_lists.c +624 -0
  124. data/ext/apex_ext/apex_src/src/extensions/quarto_lists.h +35 -0
  125. data/ext/apex_ext/apex_src/src/extensions/quarto_polish.c +264 -0
  126. data/ext/apex_ext/apex_src/src/extensions/quarto_polish.h +23 -0
  127. data/ext/apex_ext/apex_src/src/extensions/quarto_shortcodes.c +307 -0
  128. data/ext/apex_ext/apex_src/src/extensions/quarto_shortcodes.h +21 -0
  129. data/ext/apex_ext/apex_src/src/extensions/raw_content.c +351 -0
  130. data/ext/apex_ext/apex_src/src/extensions/raw_content.h +20 -0
  131. data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.c +117 -3
  132. data/ext/apex_ext/apex_src/src/extensions/special_markers.c +53 -0
  133. data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.c +23 -1
  134. data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.c +83 -92
  135. data/ext/apex_ext/apex_src/src/extensions/toc.c +446 -25
  136. data/ext/apex_ext/apex_src/src/extensions/toc.h +26 -1
  137. data/ext/apex_ext/apex_src/src/extensions/wiki_links.c +28 -0
  138. data/ext/apex_ext/apex_src/src/html_renderer.c +387 -17
  139. data/ext/apex_ext/apex_src/src/plugin_catalog.c +517 -0
  140. data/ext/apex_ext/apex_src/src/plugins_remote.c +88 -14
  141. data/ext/apex_ext/apex_src/src/plugins_remote.h +34 -0
  142. data/ext/apex_ext/apex_src/src/pretty_html.c +6 -1
  143. data/ext/apex_ext/apex_src/tests/fixtures/comprehensive_test.md +21 -0
  144. data/ext/apex_ext/apex_src/tests/fixtures/images/bear_image_attributes.md +10 -0
  145. data/ext/apex_ext/apex_src/tests/fixtures/includes/sections.md +19 -0
  146. data/ext/apex_ext/apex_src/tests/fixtures/includes/sections.txt +11 -0
  147. data/ext/apex_ext/apex_src/tests/fixtures/minimal_pb.md +2 -0
  148. data/ext/apex_ext/apex_src/tests/fixtures/obsidian-callouts.md +46 -0
  149. data/ext/apex_ext/apex_src/tests/fixtures/pagebreak_html_repro.md +5 -0
  150. data/ext/apex_ext/apex_src/tests/fixtures/python-callouts.md +47 -0
  151. data/ext/apex_ext/apex_src/tests/fixtures/quarto/callouts.md +3 -0
  152. data/ext/apex_ext/apex_src/tests/fixtures/quarto/code-attrs.md +3 -0
  153. data/ext/apex_ext/apex_src/tests/fixtures/quarto/diagrams.md +8 -0
  154. data/ext/apex_ext/apex_src/tests/fixtures/quarto/lists.md +19 -0
  155. data/ext/apex_ext/apex_src/tests/fixtures/quarto/raw-content.md +5 -0
  156. data/ext/apex_ext/apex_src/tests/fixtures/quarto/shortcodes.md +7 -0
  157. data/ext/apex_ext/apex_src/tests/fixtures/quarto/smoke.md +81 -0
  158. data/ext/apex_ext/apex_src/tests/fixtures/quarto/spans.md +5 -0
  159. data/ext/apex_ext/apex_src/tests/fixtures/quarto-callouts.md +47 -0
  160. data/ext/apex_ext/apex_src/tests/fixtures/speed.md +192 -0
  161. data/ext/apex_ext/apex_src/tests/fixtures/tables/grid-tables.md +37 -0
  162. data/ext/apex_ext/apex_src/tests/paginate_cli_test.sh +16 -0
  163. data/ext/apex_ext/apex_src/tests/test_bear_image_attrs.c +301 -0
  164. data/ext/apex_ext/apex_src/tests/test_concordance.tsv +4 -0
  165. data/ext/apex_ext/apex_src/tests/test_escaping_repro.c +82 -0
  166. data/ext/apex_ext/apex_src/tests/test_extensions.c +821 -1
  167. data/ext/apex_ext/apex_src/tests/test_ial.c +7 -0
  168. data/ext/apex_ext/apex_src/tests/test_marked_integration.c +25 -0
  169. data/ext/apex_ext/apex_src/tests/test_metadata.c +129 -0
  170. data/ext/apex_ext/apex_src/tests/test_output.c +568 -2
  171. data/ext/apex_ext/apex_src/tests/test_runner.c +11 -0
  172. data/ext/apex_ext/apex_src/tests/test_tables.c +420 -0
  173. data/ext/apex_ext/apex_src/vendor/cmark-gfm/CMakeLists.txt +1 -1
  174. data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.c +77 -1
  175. data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.c +135 -5
  176. data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/blocks.c +56 -1
  177. data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/config.h +38 -0
  178. data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/main.c +1 -1
  179. data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/__pycache__/cmark.cpython-314.pyc +0 -0
  180. data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/__pycache__/normalize.cpython-314.pyc +0 -0
  181. data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions.txt +69 -0
  182. data/ext/apex_ext/apex_src/xcode_build/CMakeScripts/ReRunCMake.make +74 -0
  183. data/ext/apex_ext/apex_src/xcode_build/CTestTestfile.cmake +22 -0
  184. data/ext/apex_ext/apex_src/xcode_build/Debug/Apex.framework/Versions/A/Apex +0 -0
  185. data/ext/apex_ext/apex_src/xcode_build/Debug/Apex.framework/Versions/A/Resources/Info.plist +44 -0
  186. data/ext/apex_ext/apex_src/xcode_build/Debug/Apex.framework/Versions/A/_CodeSignature/CodeResources +128 -0
  187. data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.pbxproj +5118 -0
  188. data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  189. data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.xcworkspace/xcuserdata/ttscoff.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  190. data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.xcworkspace/xcuserdata/ttscoff.xcuserdatad/WorkspaceSettings.xcsettings +8 -0
  191. data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/xcuserdata/ttscoff.xcuserdatad/xcschemes/xcschememanagement.plist +99 -0
  192. data/ext/apex_ext/apex_src/xcode_build/cmake_install.cmake +452 -0
  193. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/CMakeScripts/ReRunCMake.make +52 -0
  194. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/cmake_install.cmake +55 -0
  195. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/cmark-gfm.xcodeproj/project.pbxproj +2455 -0
  196. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/cmark-gfm.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  197. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/extensions/cmake_install.cmake +171 -0
  198. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/man/cmake_install.cmake +55 -0
  199. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/cmake_install.cmake +220 -0
  200. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/cmark-gfm_export.h +43 -0
  201. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/cmark-gfm_version.h +7 -0
  202. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/config.h +76 -0
  203. data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/libcmark-gfm.pc +10 -0
  204. data/ext/apex_ext/extconf.rb +35 -0
  205. data/lib/apex/version.rb +2 -2
  206. metadata +117 -2
  207. data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/tempOptimizedIndex.dsidx +0 -0
@@ -0,0 +1,1902 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+
6
+ <meta charset="UTF-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <meta name="generator" content="Apex 1.1.12">
9
+ <title>Document</title>
10
+ <style>
11
+ /* GitHub-style syntax highlighting for Pygments and Skylighting */
12
+ /* Don't apply background to wrapper when code highlighting is enabled - let default styles handle it */
13
+ .code-highlighted .highlight, .code-highlighted .sourceCode { background: inherit; border-radius: 6px; padding: 16px; overflow-x: auto; }
14
+ .highlight pre, .sourceCode pre { margin: 0; padding: 0; background: transparent; }
15
+ .highlight code, .sourceCode code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 12px; line-height: 1.45; }
16
+ /* Pygments classes */
17
+ .highlight .k { color: #d73a49; font-weight: 600; } /* Keyword */
18
+ .highlight .kt { color: #d73a49; } /* Keyword.Type */
19
+ .highlight .kd { color: #d73a49; font-weight: 600; } /* Keyword.Declaration */
20
+ .highlight .kn { color: #d73a49; } /* Keyword.Namespace */
21
+ .highlight .kp { color: #d73a49; } /* Keyword.Pseudo */
22
+ .highlight .kr { color: #d73a49; font-weight: 600; } /* Keyword.Reserved */
23
+ .highlight .n { color: #6f42c1; } /* Name */
24
+ .highlight .na { color: #6f42c1; } /* Name.Attribute */
25
+ .highlight .nc { color: #6f42c1; font-weight: 600; } /* Name.Class */
26
+ .highlight .no { color: #005cc5; } /* Name.Constant */
27
+ .highlight .nd { color: #6f42c1; font-weight: 600; } /* Name.Decorator */
28
+ .highlight .ni { color: #800080; } /* Name.Entity */
29
+ .highlight .ne { color: #990000; font-weight: 600; } /* Name.Exception */
30
+ .highlight .nf { color: #6f42c1; font-weight: 600; } /* Name.Function */
31
+ .highlight .nl { color: #6f42c1; } /* Name.Label */
32
+ .highlight .nn { color: #555; } /* Name.Namespace */
33
+ .highlight .nt { color: #22863a; } /* Name.Tag */
34
+ .highlight .nv { color: #e36209; } /* Name.Variable */
35
+ .highlight .s { color: #032f62; } /* String */
36
+ .highlight .sb { color: #032f62; } /* String.Backtick */
37
+ .highlight .sc { color: #032f62; } /* String.Char */
38
+ .highlight .sd { color: #032f62; } /* String.Doc */
39
+ .highlight .s2 { color: #032f62; } /* String.Double */
40
+ .highlight .se { color: #032f62; } /* String.Escape */
41
+ .highlight .sh { color: #032f62; } /* String.Heredoc */
42
+ .highlight .si { color: #032f62; } /* String.Interpol */
43
+ .highlight .sx { color: #032f62; } /* String.Other */
44
+ .highlight .sr { color: #032f62; } /* String.Regex */
45
+ .highlight .s1 { color: #032f62; } /* String.Single */
46
+ .highlight .ss { color: #032f62; } /* String.Symbol */
47
+ .highlight .c { color: #6a737d; font-style: italic; } /* Comment */
48
+ .highlight .c1 { color: #6a737d; font-style: italic; } /* Comment.Single */
49
+ .highlight .cm { color: #6a737d; font-style: italic; } /* Comment.Multiline */
50
+ .highlight .cp { color: #6a737d; font-weight: 600; } /* Comment.Preproc */
51
+ .highlight .cs { color: #6a737d; font-weight: 600; font-style: italic; } /* Comment.Special */
52
+ .highlight .m { color: #005cc5; } /* Literal.Number */
53
+ .highlight .mb { color: #005cc5; } /* Literal.Number.Bin */
54
+ .highlight .mf { color: #005cc5; } /* Literal.Number.Float */
55
+ .highlight .mh { color: #005cc5; } /* Literal.Number.Hex */
56
+ .highlight .mi { color: #005cc5; } /* Literal.Number.Integer */
57
+ .highlight .il { color: #005cc5; } /* Literal.Number.Integer.Long */
58
+ .highlight .mo { color: #005cc5; } /* Literal.Number.Oct */
59
+ .highlight .o { color: #d73a49; } /* Operator */
60
+ .highlight .ow { color: #d73a49; } /* Operator.Word */
61
+ .highlight .p { color: #24292e; } /* Punctuation */
62
+ .highlight .w { color: #e1e4e8; } /* Text.Whitespace */
63
+ /* Skylighting classes */
64
+ .sourceCode .kw { color: #d73a49; font-weight: 600; } /* Keyword */
65
+ .sourceCode .dt { color: #6f42c1; } /* DataType */
66
+ .sourceCode .dv { color: #005cc5; } /* DecVal */
67
+ .sourceCode .bn { color: #005cc5; } /* BaseN */
68
+ .sourceCode .fl { color: #005cc5; } /* Float */
69
+ .sourceCode .ch { color: #032f62; } /* Char */
70
+ .sourceCode .st { color: #032f62; } /* String */
71
+ .sourceCode .co { color: #6a737d; font-style: italic; } /* Comment */
72
+ .sourceCode .ot { color: #22863a; } /* Other */
73
+ .sourceCode .al { color: #e36209; font-weight: 600; } /* Alert */
74
+ .sourceCode .fu { color: #6f42c1; font-weight: 600; } /* Function */
75
+ .sourceCode .re { color: #032f62; } /* RegionMarker */
76
+ .sourceCode .er { color: #d73a49; font-weight: 600; } /* Error */
77
+ .sourceCode .cf { color: #d73a49; font-weight: 600; } /* ControlFlow */
78
+ .sourceCode .op { color: #d73a49; } /* Operator */
79
+ .sourceCode .pp { color: #6a737d; } /* Preprocessor */
80
+ .sourceCode .at { color: #005cc5; } /* Attribute */
81
+ .sourceCode .do { color: #6a737d; font-style: italic; } /* Documentation */
82
+ .sourceCode .an { color: #6a737d; font-weight: 600; } /* Annotation */
83
+ .sourceCode .cv { color: #6a737d; font-weight: 600; font-style: italic; } /* CommentVar */
84
+ .sourceCode .in { color: #6a737d; } /* Information */
85
+ .sourceCode .wa { color: #e36209; font-weight: 600; } /* Warning */
86
+ .sourceCode .im { color: #d73a49; } /* Import */
87
+ .sourceCode .bu { color: #005cc5; } /* BuiltIn */
88
+ .sourceCode .ex { color: #6f42c1; } /* Extension */
89
+ .sourceCode .va { color: #e36209; } /* Variable */
90
+ .sourceCode .ss { color: #032f62; } /* SpecialString */
91
+ .sourceCode .sc { color: #032f62; } /* SpecialChar */
92
+ .sourceCode .vs { color: #032f62; } /* VerbatimString */
93
+ .sourceCode .il { color: #005cc5; } /* Special */
94
+ /* Line numbers (Skylighting) */
95
+ .sourceCode.numberSource .sourceCode { counter-reset: line; }
96
+ .sourceCode.numberSource .sourceCode > span { position: relative; left: -4em; counter-increment: line; }
97
+ .sourceCode.numberSource .sourceCode > span > a:first-child::before { content: counter(line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; min-width: 1em; padding-right: 0.5em; color: #aaa; }
98
+ </style>
99
+ <style>
100
+ body {
101
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
102
+ line-height: 1.6;
103
+ max-width: 800px;
104
+ margin: 2rem auto;
105
+ padding: 0 1rem;
106
+ color: #333;
107
+ }
108
+ pre { background: #f5f5f5; padding: 1rem; overflow-x: auto; }
109
+ code { background: #f0f0f0; padding: 0.2em 0.4em; border-radius: 3px; }
110
+ blockquote { border-left: 4px solid #ddd; margin: 0; padding-left: 1rem; color: #666; }
111
+ table { border-collapse: collapse; width: 100%%; }
112
+ th, td { border: 1px solid #ddd; padding: 0.5rem; }
113
+ th { background: #f5f5f5; }
114
+ tfoot td { background: #e8e8e8; }
115
+ figure.table-figure { width: fit-content; margin: 1em 0; }
116
+ figure.table-figure table { width: auto; }
117
+ figcaption { text-align: center; font-weight: bold; font-size: 0.8em; }
118
+ .page-break { page-break-after: always; }
119
+ .callout { padding: 1rem; margin: 1rem 0; border-left: 4px solid; }
120
+ .callout-note { border-color: #3b82f6; background: #eff6ff; }
121
+ .callout-warning { border-color: #f59e0b; background: #fffbeb; }
122
+ .callout-tip { border-color: #10b981; background: #f0fdf4; }
123
+ .callout-danger { border-color: #ef4444; background: #fef2f2; }
124
+ ins { background: #d4fcbc; text-decoration: none; }
125
+ del { background: #fbb6c2; text-decoration: line-through; }
126
+ mark { background: #fff3cd; }
127
+ .smallcaps { font-variant: small-caps; }
128
+ .underline { text-decoration: underline; }
129
+ span.mark { background: #fff3cd; }
130
+ .hidden { display: none; }
131
+ .quarto-xref { font-variant: normal; }
132
+ .critic.comment { background: #e7e7e7; color: #666; font-style: italic; }
133
+ .mkhashtag { color: #666; }
134
+ .mkstyledtag {
135
+ display: inline-block;
136
+ background: #e0e0e0;
137
+ padding: 3px 9px;
138
+ border-radius: 20px;
139
+ font-size: 0.9em;
140
+ line-height: 1.4;
141
+ color: #333;
142
+ margin: 0 2px;
143
+ }
144
+ </style>
145
+ <meta name="paginate" content="symbols"/>
146
+ <meta name="highlight-language-only" content="true"/>
147
+ <meta name="code-line-numbers" content="false"/>
148
+ <meta name="code-highlight" content="pygments"/>
149
+ <meta name="sup-sub" content="true"/>
150
+ <meta name="relaxed-tables" content="true"/>
151
+ <meta name="includes" content="true"/>
152
+ <meta name="autolink" content="true"/>
153
+ <meta name="pretty" content="false"/>
154
+ <meta name="standalone" content="false"/>
155
+ <meta name="mode" content="unified"/>
156
+ <meta name="markdown-in-html" content="true"/>
157
+ <meta name="image-captions" content="true"/>
158
+ <meta name="wikilink-extension" content="html"/>
159
+ <meta name="wikilink-space" content="hyphen"/>
160
+ <meta name="wikilinks" content="true"/>
161
+ <meta name="widont" content="true"/>
162
+ <meta name="plugins" content="true"/>
163
+ <meta name="id-format" content="gfm"/>
164
+
165
+ <style>
166
+ :root {
167
+ /* border-box width of the fixed sidebar; body offset includes a small gap */
168
+ --sidebar-width: 250px;
169
+ --sidebar-offset: 270px;
170
+ }
171
+
172
+ /* Base styles — override Apex standalone centering (max-width + margin: auto) */
173
+ body {
174
+ -webkit-font-smoothing: antialiased;
175
+ -moz-osx-font-smoothing: grayscale;
176
+ font-size: 17px;
177
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
178
+ "Helvetica Neue", Arial, sans-serif;
179
+ line-height: 1.65;
180
+ color: #1e293b;
181
+ background-color: #fff;
182
+ max-width: none;
183
+ width: auto;
184
+ margin: 2rem 2rem 2rem var(--sidebar-offset);
185
+ padding: 0 1rem;
186
+ box-sizing: border-box;
187
+ }
188
+
189
+ /* Sidebar / Main TOC - wider on larger screens */
190
+ .main-toc,
191
+ .sidebar {
192
+ position: fixed;
193
+ left: 0;
194
+ top: 0;
195
+ box-sizing: border-box;
196
+ width: var(--sidebar-width);
197
+ min-width: var(--sidebar-width);
198
+ max-width: var(--sidebar-width);
199
+ height: 100vh;
200
+ overflow-y: auto;
201
+ background: #1e293b;
202
+ color: rgba(255, 255, 255, 0.9);
203
+ border-right: 2px solid rgba(255, 255, 255, 0.1);
204
+ padding: 24px 20px 130px;
205
+ font-size: 14px;
206
+ z-index: 100;
207
+ box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
208
+ transition: transform 0.3s ease;
209
+ }
210
+
211
+ .main-toc ul,
212
+ .sidebar ul {
213
+ list-style: none;
214
+ padding-left: 0;
215
+ margin: 0;
216
+ padding-bottom: 80px;
217
+ }
218
+
219
+ .main-toc ul::after,
220
+ .sidebar ul::after {
221
+ content: "";
222
+ display: block;
223
+ height: 80px;
224
+ }
225
+
226
+ .main-toc li,
227
+ .sidebar li {
228
+ margin: 0.25em 0;
229
+ }
230
+
231
+ .main-toc a,
232
+ .sidebar a {
233
+ color: rgba(255, 255, 255, 0.85);
234
+ text-decoration: none;
235
+ display: block;
236
+ padding: 6px 12px;
237
+ border-radius: 4px;
238
+ transition: all 0.15s ease;
239
+ white-space: nowrap;
240
+ overflow: hidden;
241
+ text-overflow: ellipsis;
242
+ }
243
+
244
+ .main-toc a:hover,
245
+ .sidebar a:hover {
246
+ background: #334155;
247
+ color: #fff;
248
+ }
249
+
250
+ .sidebar a.active {
251
+ color: #0ea5e9;
252
+ font-weight: 500;
253
+ }
254
+
255
+ /* Hamburger menu button */
256
+ .hamburger-menu {
257
+ display: none;
258
+ position: fixed;
259
+ top: 12px;
260
+ left: 12px;
261
+ z-index: 200;
262
+ background: #1e293b;
263
+ border: 2px solid rgba(255, 255, 255, 0.1);
264
+ border-radius: 6px;
265
+ padding: 10px;
266
+ cursor: pointer;
267
+ color: rgba(255, 255, 255, 0.9);
268
+ font-size: 20px;
269
+ line-height: 1;
270
+ box-sizing: border-box;
271
+ width: 44px;
272
+ height: 44px;
273
+ align-items: center;
274
+ justify-content: center;
275
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
276
+ transition: all 0.2s ease;
277
+ opacity: 0.2;
278
+ }
279
+
280
+ .hamburger-menu:hover {
281
+ background: #334155;
282
+ color: #fff;
283
+ opacity: 1;
284
+ }
285
+
286
+ /* Move hamburger to the right of the sidebar when menu is open */
287
+ .hamburger-menu.active {
288
+ left: calc(var(--sidebar-width) + 12px);
289
+ }
290
+
291
+ .hamburger-menu.active {
292
+ background: #0ea5e9;
293
+ }
294
+
295
+ .hamburger-menu::before {
296
+ content: "☰";
297
+ }
298
+
299
+ .hamburger-menu.active::before {
300
+ content: "✕";
301
+ }
302
+
303
+ /* Mobile menu overlay */
304
+ .mobile-menu-overlay {
305
+ display: none;
306
+ position: fixed;
307
+ top: 0;
308
+ left: 0;
309
+ right: 0;
310
+ bottom: 0;
311
+ background: rgba(0, 0, 0, 0.5);
312
+ z-index: 150;
313
+ opacity: 0;
314
+ visibility: hidden;
315
+ transition: opacity 0.3s ease, visibility 0.3s ease;
316
+ }
317
+
318
+ .mobile-menu-overlay.active {
319
+ opacity: 1;
320
+ visibility: visible;
321
+ }
322
+
323
+ /* Page TOC */
324
+ .page-toc {
325
+ background: #f9f9f9;
326
+ border: 1px solid #ddd;
327
+ border-radius: 4px;
328
+ padding: 1rem;
329
+ margin: 1.5rem 0;
330
+ }
331
+
332
+ .page-toc ul {
333
+ list-style: none;
334
+ padding-left: 0;
335
+ margin: 0;
336
+ }
337
+
338
+ .page-toc > ul {
339
+ padding-left: 0;
340
+ }
341
+
342
+ .page-toc li {
343
+ margin: 0.25em 0;
344
+ }
345
+
346
+ .page-toc a {
347
+ color: #0066cc;
348
+ text-decoration: none;
349
+ display: block;
350
+ padding: 0.25em 0.5em;
351
+ border-radius: 3px;
352
+ }
353
+
354
+ .page-toc a:hover {
355
+ background: #e0e0e0;
356
+ color: #004499;
357
+ }
358
+
359
+ .page-toc ul ul {
360
+ list-style: none;
361
+ padding-left: 1.5em;
362
+ margin-top: 0.25em;
363
+ margin-left: 0;
364
+ }
365
+
366
+ .page-toc ul ul ul {
367
+ padding-left: 1.5em;
368
+ }
369
+
370
+ .page-toc ul ul a {
371
+ font-size: 0.9em;
372
+ color: #555;
373
+ }
374
+
375
+ .page-toc ul ul ul a {
376
+ font-size: 0.85em;
377
+ color: #666;
378
+ }
379
+
380
+ /* Floating TOC */
381
+ .floating-toc {
382
+ position: fixed;
383
+ top: 0;
384
+ left: var(--sidebar-offset);
385
+ right: 0;
386
+ z-index: 50;
387
+ opacity: 0;
388
+ visibility: hidden;
389
+ transition: opacity 0.2s ease, visibility 0.2s ease;
390
+ pointer-events: none;
391
+ display: flex;
392
+ justify-content: flex-end;
393
+ padding-right: 2rem;
394
+ }
395
+
396
+ .floating-toc.visible {
397
+ opacity: 1;
398
+ visibility: visible;
399
+ pointer-events: auto;
400
+ }
401
+
402
+ .floating-toc-container {
403
+ background: rgba(255, 255, 255, 0.95);
404
+ backdrop-filter: blur(10px);
405
+ border-bottom: 1px solid #ddd;
406
+ border-radius: 0 0 12px 12px;
407
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
408
+ width: fit-content;
409
+ max-width: 400px;
410
+ min-width: 200px;
411
+ overflow: hidden;
412
+ transition: max-height 0.3s ease;
413
+ }
414
+
415
+ .floating-toc-header {
416
+ padding: 8px 16px;
417
+ cursor: pointer;
418
+ user-select: none;
419
+ font-size: 14px;
420
+ font-weight: 500;
421
+ color: #1e293b;
422
+ display: flex;
423
+ align-items: center;
424
+ justify-content: space-between;
425
+ }
426
+
427
+ .floating-toc-header:hover {
428
+ background: rgba(0, 0, 0, 0.02);
429
+ }
430
+
431
+ .floating-toc-content {
432
+ max-height: 0;
433
+ overflow: hidden;
434
+ transition: max-height 0.3s ease;
435
+ }
436
+
437
+ .floating-toc-container:hover .floating-toc-content {
438
+ max-height: 70vh;
439
+ overflow-y: auto;
440
+ }
441
+
442
+ .floating-toc-content ul {
443
+ list-style: none;
444
+ padding: 8px 16px 16px;
445
+ margin: 0;
446
+ }
447
+
448
+ .floating-toc-content li {
449
+ margin: 0.1em 0;
450
+ }
451
+
452
+ .floating-toc-content a {
453
+ color: #0066cc;
454
+ text-decoration: none;
455
+ display: block;
456
+ padding: 0.2em 0.5em;
457
+ border-radius: 4px;
458
+ font-size: 13px;
459
+ transition: background 0.15s ease;
460
+ }
461
+
462
+ .floating-toc-content a:hover {
463
+ background: #e0e0e0;
464
+ color: #004499;
465
+ }
466
+
467
+ .floating-toc-content ul ul {
468
+ padding-left: 1.2em;
469
+ margin-top: 0;
470
+ margin-bottom: 0;
471
+ }
472
+
473
+ .floating-toc-content ul ul ul {
474
+ margin-top: 0;
475
+ margin-bottom: 0;
476
+ }
477
+
478
+ .floating-toc-content ul ul a {
479
+ font-size: 12px;
480
+ color: #555;
481
+ }
482
+
483
+ .floating-toc-content ul ul ul a {
484
+ font-size: 11px;
485
+ color: #666;
486
+ }
487
+
488
+ /* Smooth scrolling */
489
+ html {
490
+ scroll-behavior: smooth;
491
+ }
492
+
493
+ /* Code blocks */
494
+ code {
495
+ background: #f0f0f0;
496
+ padding: 0.2em 0.4em;
497
+ border-radius: 3px;
498
+ font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
499
+ font-size: 0.9em;
500
+ margin: 0 0.1em;
501
+ }
502
+
503
+ pre {
504
+ background: #f5f5f5;
505
+ padding: 1rem;
506
+ overflow-x: auto;
507
+ border-radius: 4px;
508
+ margin: 1em 0;
509
+ }
510
+
511
+ pre code {
512
+ background: none;
513
+ padding: 0;
514
+ margin: 0;
515
+ }
516
+
517
+ /* Rouge syntax highlighting - GitHub theme, scoped to .highlight containers */
518
+ .highlight {
519
+ color: #24292e;
520
+ }
521
+
522
+ .highlight .c {
523
+ color: #6a737d;
524
+ font-style: italic;
525
+ } /* Comment */
526
+ .highlight .err {
527
+ color: #a61717;
528
+ background-color: #e3d2d2;
529
+ } /* Error */
530
+ .highlight .k {
531
+ color: #d73a49;
532
+ font-weight: bold;
533
+ } /* Keyword */
534
+ .highlight .l {
535
+ color: #032f62;
536
+ } /* Literal */
537
+ .highlight .n {
538
+ color: #24292e;
539
+ } /* Name */
540
+ .highlight .o {
541
+ color: #d73a49;
542
+ } /* Operator */
543
+ .highlight .p {
544
+ color: #24292e;
545
+ } /* Punctuation */
546
+ .highlight .cm {
547
+ color: #6a737d;
548
+ font-style: italic;
549
+ } /* Comment.Multiline */
550
+ .highlight .cp {
551
+ color: #6a737d;
552
+ font-weight: bold;
553
+ } /* Comment.Preproc */
554
+ .highlight .c1 {
555
+ color: #6a737d;
556
+ font-style: italic;
557
+ } /* Comment.Single */
558
+ .highlight .cs {
559
+ color: #6a737d;
560
+ font-weight: bold;
561
+ font-style: italic;
562
+ } /* Comment.Special */
563
+ .highlight .gd {
564
+ color: #24292e;
565
+ background-color: #ffeef0;
566
+ } /* Generic.Deleted */
567
+ .highlight .ge {
568
+ color: #24292e;
569
+ font-style: italic;
570
+ } /* Generic.Emph */
571
+ .highlight .gr {
572
+ color: #aa0000;
573
+ } /* Generic.Error */
574
+ .highlight .gh {
575
+ color: #999999;
576
+ font-weight: bold;
577
+ } /* Generic.Heading */
578
+ .highlight .gi {
579
+ color: #24292e;
580
+ background-color: #f0fff4;
581
+ } /* Generic.Inserted */
582
+ .highlight .go {
583
+ color: #888888;
584
+ } /* Generic.Output */
585
+ .highlight .gp {
586
+ color: #555555;
587
+ } /* Generic.Prompt */
588
+ .highlight .gs {
589
+ font-weight: bold;
590
+ } /* Generic.Strong */
591
+ .highlight .gu {
592
+ color: #aaaaaa;
593
+ } /* Generic.Subheading */
594
+ .highlight .gt {
595
+ color: #aa0000;
596
+ } /* Generic.Traceback */
597
+ .highlight .kc {
598
+ color: #d73a49;
599
+ font-weight: bold;
600
+ } /* Keyword.Constant */
601
+ .highlight .kd {
602
+ color: #d73a49;
603
+ font-weight: bold;
604
+ } /* Keyword.Declaration */
605
+ .highlight .kn {
606
+ color: #d73a49;
607
+ font-weight: bold;
608
+ } /* Keyword.Namespace */
609
+ .highlight .kp {
610
+ color: #d73a49;
611
+ font-weight: bold;
612
+ } /* Keyword.Pseudo */
613
+ .highlight .kr {
614
+ color: #d73a49;
615
+ font-weight: bold;
616
+ } /* Keyword.Reserved */
617
+ .highlight .kt {
618
+ color: #d73a49;
619
+ font-weight: bold;
620
+ } /* Keyword.Type */
621
+ .highlight .ld {
622
+ color: #032f62;
623
+ } /* Literal.Date */
624
+ .highlight .m {
625
+ color: #005cc5;
626
+ } /* Literal.Number */
627
+ .highlight .s {
628
+ color: #032f62;
629
+ } /* Literal.String */
630
+ .highlight .na {
631
+ color: #6f42c1;
632
+ } /* Name.Attribute */
633
+ .highlight .nb {
634
+ color: #005cc5;
635
+ } /* Name.Builtin */
636
+ .highlight .nc {
637
+ color: #6f42c1;
638
+ font-weight: bold;
639
+ } /* Name.Class */
640
+ .highlight .no {
641
+ color: #005cc5;
642
+ } /* Name.Constant */
643
+ .highlight .nd {
644
+ color: #6f42c1;
645
+ font-weight: bold;
646
+ } /* Name.Decorator */
647
+ .highlight .ni {
648
+ color: #800080;
649
+ } /* Name.Entity */
650
+ .highlight .ne {
651
+ color: #990000;
652
+ font-weight: bold;
653
+ } /* Name.Exception */
654
+ .highlight .nf {
655
+ color: #6f42c1;
656
+ } /* Name.Function */
657
+ .highlight .nl {
658
+ color: #990000;
659
+ } /* Name.Label */
660
+ .highlight .nn {
661
+ color: #555555;
662
+ } /* Name.Namespace */
663
+ .highlight .nx {
664
+ color: #6f42c1;
665
+ } /* Name.Other */
666
+ .highlight .py {
667
+ color: #990000;
668
+ } /* Name.Property */
669
+ .highlight .nt {
670
+ color: #22863a;
671
+ } /* Name.Tag */
672
+ .highlight .nv {
673
+ color: #e36209;
674
+ } /* Name.Variable */
675
+ .highlight .ow {
676
+ color: #d73a49;
677
+ font-weight: bold;
678
+ } /* Operator.Word */
679
+ .highlight .w {
680
+ color: #bbbbbb;
681
+ } /* Text.Whitespace */
682
+ .highlight .mf {
683
+ color: #005cc5;
684
+ } /* Literal.Number.Float */
685
+ .highlight .mh {
686
+ color: #005cc5;
687
+ } /* Literal.Number.Hex */
688
+ .highlight .mi {
689
+ color: #005cc5;
690
+ } /* Literal.Number.Integer */
691
+ .highlight .mo {
692
+ color: #005cc5;
693
+ } /* Literal.Number.Oct */
694
+ .highlight .sb {
695
+ color: #032f62;
696
+ } /* Literal.String.Backtick */
697
+ .highlight .sc {
698
+ color: #032f62;
699
+ } /* Literal.String.Char */
700
+ .highlight .sd {
701
+ color: #032f62;
702
+ } /* Literal.String.Doc */
703
+ .highlight .s2 {
704
+ color: #032f62;
705
+ } /* Literal.String.Double */
706
+ .highlight .se {
707
+ color: #032f62;
708
+ } /* Literal.String.Escape */
709
+ .highlight .sh {
710
+ color: #032f62;
711
+ } /* Literal.String.Heredoc */
712
+ .highlight .si {
713
+ color: #032f62;
714
+ } /* Literal.String.Interpol */
715
+ .highlight .sx {
716
+ color: #032f62;
717
+ } /* Literal.String.Other */
718
+ .highlight .sr {
719
+ color: #22863a;
720
+ } /* Literal.String.Regex */
721
+ .highlight .s1 {
722
+ color: #032f62;
723
+ } /* Literal.String.Single */
724
+ .highlight .ss {
725
+ color: #032f62;
726
+ } /* Literal.String.Symbol */
727
+ .highlight .bp {
728
+ color: #005cc5;
729
+ } /* Name.Builtin.Pseudo */
730
+ .highlight .vc {
731
+ color: #e36209;
732
+ } /* Name.Variable.Class */
733
+ .highlight .vg {
734
+ color: #e36209;
735
+ } /* Name.Variable.Global */
736
+ .highlight .vi {
737
+ color: #e36209;
738
+ } /* Name.Variable.Instance */
739
+ .highlight .il {
740
+ color: #005cc5;
741
+ } /* Literal.Number.Integer.Long */
742
+
743
+ /* Additional Rouge token classes that may be used */
744
+ .highlight .token {
745
+ color: #5670a0;
746
+ }
747
+ .highlight .token.list {
748
+ color: #546e9f;
749
+ }
750
+ .highlight .token.punctuation {
751
+ color: #3e8dad;
752
+ }
753
+ .highlight .token.list.punctuation {
754
+ color: #e05b78;
755
+ }
756
+ .highlight .token.content {
757
+ padding: 0;
758
+ }
759
+
760
+ /* Nested lists in page content */
761
+ ul ul,
762
+ ol ol,
763
+ ul ol,
764
+ ol ul {
765
+ padding-left: 1.5em;
766
+ margin-top: 0.25em;
767
+ }
768
+
769
+ /* Page footer */
770
+ .page-footer {
771
+ background: #f5f5f5;
772
+ border-top: 1px solid #ddd;
773
+ padding: 1.5rem;
774
+ margin-top: 3rem;
775
+ color: #666;
776
+ font-size: 0.9em;
777
+ }
778
+
779
+ .page-footer p {
780
+ margin: 0.5em 0;
781
+ }
782
+
783
+ .page-footer a {
784
+ color: #0066cc;
785
+ text-decoration: none;
786
+ }
787
+
788
+ .page-footer a:hover {
789
+ text-decoration: underline;
790
+ }
791
+
792
+ /* Mobile responsive */
793
+ @media (max-width: 768px) {
794
+ .hamburger-menu {
795
+ display: flex;
796
+ }
797
+
798
+ .main-toc,
799
+ .sidebar {
800
+ transform: translateX(-100%);
801
+ z-index: 175;
802
+ }
803
+
804
+ .main-toc.mobile-open,
805
+ .sidebar.mobile-open {
806
+ transform: translateX(0);
807
+ }
808
+
809
+ body {
810
+ margin: 2rem 1rem;
811
+ }
812
+
813
+ .floating-toc {
814
+ left: 0;
815
+ }
816
+ }
817
+
818
+ </style></head>
819
+
820
+ <body class="code-highlighted">
821
+ <div class="floating-toc" id="floating-toc">
822
+ <div class="floating-toc-container">
823
+ <div class="floating-toc-header">
824
+ <span>Table of Contents 🔻</span>
825
+ </div>
826
+ <div class="floating-toc-content" id="floating-toc-content">
827
+ <!-- Content will be populated by JavaScript -->
828
+ </div>
829
+ </div>
830
+ </div>
831
+
832
+ <button class="hamburger-menu" id="hamburger-menu" aria-label="Toggle navigation"></button>
833
+ <div class="mobile-menu-overlay" id="mobile-menu-overlay"></div>
834
+
835
+ <nav class="main-toc"><ul><li><a href="Home.html">Home</a></li><li><a href="Getting-Started.html">Getting Started</a></li><li><a href="Installation.html">Installation</a></li><li><a href="Usage.html">Usage</a></li><li><a href="Syntax.html">Syntax</a></li><li><a href="Callouts.html">Callouts</a></li><li><a href="Tables.html">Tables</a></li><li><a href="Inline-Attribute-Lists.html">Inline Attribute Lists</a></li><li><a href="Modes.html">Modes</a></li><li><a href="Quarto-Mode.html">Quarto Mode</a></li><li><a href="Command-Line-Options.html">Command Line Options</a></li><li><a href="Rendering-Markdown-In-Terminal.html">Rendering Markdown in the Terminal</a></li><li><a href="Generating-Man-Pages.html">Generating Man Pages</a></li><li><a href="Multi-File-Documents.html">Multi-file Documents</a></li><li><a href="Citations.html">Citations</a></li><li><a href="Indices.html">Indices</a></li><li><a href="Metadata-Transforms.html">Metadata Transforms</a></li><li><a href="Pandoc-Integration.html">Integrating with Pandoc</a></li><li><a href="Using-Apex-with-Jekyll.html">Using Apex with Jekyll</a></li><li><a href="Header-IDs.html">Header IDs</a></li><li><a href="C-API.html">C API</a></li><li><a href="Writing-Tests.html">Writing Tests</a></li><li><a href="Xcode-Integration.html">Xcode Integration</a></li><li><a href="Examples.html">Examples</a></li><li><a href="Plugins.html">Plugins</a></li><li><a href="Filters.html">Filters</a></li><li><a href="Troubleshooting.html">Troubleshooting</a></li><li><a href="Credits.html">Credits</a></li></ul></nav>
836
+
837
+ <h1 id="rendering-markdown-in-the-terminal">
838
+ Rendering Markdown in the&nbsp;Terminal
839
+ </h1>
840
+ <nav class="page-toc" id="page-toc-top"><ul><li><a href="#rendering-markdown-in-the-terminal">Rendering Markdown in the&nbsp;Terminal</a><ul><li><a href="#output-formats-t-to">Output formats:&nbsp;-t&nbsp;/&nbsp;--to</a></li><li><a href="#options">Options</a><ul><li><a href="#theme-name">--theme&nbsp;NAME</a></li><li><a href="#width-n">--width&nbsp;N</a></li><li><a href="#code-highlight-theme-theme">--code-highlight-theme&nbsp;THEME</a></li><li><a href="#list-themes">--list-themes</a></li><li><a href="#p-paginate">-p,&nbsp;--paginate</a></li><li><a href="#paginate-symbols">--paginate-symbols</a></li><li><a href="#no-paginate">--no-paginate</a></li></ul></li><li><a href="#inline-images-terminal-graphics">Inline images (terminal&nbsp;graphics)</a><ul><li><a href="#no-terminal-images">--no-terminal-images</a></li><li><a href="#terminal-image-width-n">--terminal-image-width&nbsp;N</a></li></ul></li><li><a href="#configuration-and-metadata">Configuration and&nbsp;metadata</a><ul><li><a href="#metadata-keys">Metadata&nbsp;keys</a></li></ul></li><li><a href="#theme-file-format">Theme file&nbsp;format</a><ul><li><a href="#location-and-naming">Location&nbsp;and&nbsp;naming</a></li><li><a href="#element-keys">Element&nbsp;keys</a></li><li><a href="#example-theme-excerpt">Example theme&nbsp;(excerpt)</a></li></ul></li><li><a href="#debugging-terminal-output">Debugging terminal&nbsp;output</a></li><li><a href="#typical-use-cases">Typical&nbsp;use&nbsp;cases</a></li><li><a href="#replacing-mdless-and-similar-tools">Replacing mdless and similar&nbsp;tools</a></li><li><a href="#see-also">See&nbsp;also</a></li></ul></li></ul></nav>
841
+
842
+ <p>
843
+ Apex can render Markdown to ANSI-colored output suitable for TTYs, terminal emulators, and terminal-based file manager previews (e.g. <strong>lf</strong>, <strong>yazi</strong>). This page describes the output formats, CLI flags, and configuration options.
844
+ </p>
845
+
846
+ <h2 id="output-formats-t-to">
847
+ Output formats:&nbsp;<code>-t</code>&nbsp;/&nbsp;<code>--to</code>
848
+ </h2>
849
+
850
+ <p>
851
+ Use <strong><code>-t</code></strong> or <strong><code>--to</code></strong> to choose the output format. For terminal rendering, use one of:
852
+ </p>
853
+
854
+ <table>
855
+
856
+ <thead>
857
+
858
+ <tr>
859
+
860
+ <th>
861
+ Format
862
+ </th>
863
+
864
+ <th>
865
+ Aliases
866
+ </th>
867
+
868
+ <th>
869
+ Description
870
+ </th>
871
+
872
+ </tr>
873
+
874
+ </thead>
875
+
876
+ <tbody>
877
+
878
+ <tr>
879
+
880
+ <td>
881
+ <strong>terminal</strong>
882
+ </td>
883
+
884
+ <td>
885
+ <strong>cli</strong>
886
+ </td>
887
+
888
+ <td>
889
+ 8/16-color ANSI output (standard and bright colors). Best compatibility with basic terminals.
890
+ </td>
891
+
892
+ </tr>
893
+ <tr>
894
+
895
+ <td>
896
+ <strong>terminal256</strong>
897
+ </td>
898
+
899
+ <td>
900
+
901
+ </td>
902
+
903
+ <td>
904
+ 256-color ANSI output (xterm-256 palette). Richer colors when your terminal supports it.
905
+ </td>
906
+
907
+ </tr>
908
+ </tbody>
909
+
910
+ </table>
911
+
912
+ <p>
913
+ <strong>Examples:</strong>
914
+ </p>
915
+
916
+ <div class="highlight">
917
+ <pre><span></span><span class="c1"># 16-color terminal output (default theme)</span>
918
+ apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal
919
+
920
+ <span class="c1"># Same as above (cli is an alias for terminal)</span>
921
+ apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>cli
922
+
923
+ <span class="c1"># 256-color terminal output</span>
924
+ apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256
925
+
926
+ <span class="c1"># Pipe from stdin</span>
927
+ cat<span class="w"> </span>doc.md<span class="w"> </span><span class="p">|</span><span class="w"> </span>apex<span class="w"> </span>-t<span class="w"> </span>terminal
928
+ </pre>
929
+ </div>
930
+
931
+ <p>
932
+ Output is written to stdout. Redirect or pipe as needed:
933
+ </p>
934
+
935
+ <div class="highlight">
936
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal<span class="w"> </span><span class="p">|</span><span class="w"> </span>less<span class="w"> </span>-R
937
+ apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>-o<span class="w"> </span>-
938
+ </pre>
939
+ </div>
940
+
941
+ <h2 id="options">
942
+ Options
943
+ </h2>
944
+
945
+ <h3 id="theme-name">
946
+ <code>--theme&nbsp;NAME</code>
947
+ </h3>
948
+
949
+ <p>
950
+ Load a terminal theme from:
951
+ </p>
952
+
953
+ <ul>
954
+
955
+ <li>
956
+ <strong><code>~/.config/apex/terminal/themes/NAME.theme</code></strong> (when <code>NAME</code> is given)
957
+ </li>
958
+
959
+ <li>
960
+ <strong><code>~/.config/apex/terminal/themes/default.theme</code></strong> (when no theme is specified and a default file exists)
961
+ </li>
962
+
963
+ </ul>
964
+
965
+ <p>
966
+ Themes are YAML files that map element types to colors and optional bold. See <a href="#theme-file-format">Theme file format</a> below.
967
+ </p>
968
+
969
+ <p>
970
+ <strong>Examples:</strong>
971
+ </p>
972
+
973
+ <div class="highlight">
974
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal<span class="w"> </span>--theme<span class="w"> </span>brett
975
+ apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>--theme<span class="w"> </span>dark
976
+ </pre>
977
+ </div>
978
+
979
+ <h3 Format id="width-n">
980
+ <code>--width&nbsp;N</code>
981
+ </h3>
982
+
983
+ <p>
984
+ Hard-wrap terminal (and terminal256) output at <strong>N visible columns</strong>. ANSI escape sequences are not counted toward the width, so colors and formatting are preserved while lines are wrapped. Useful when:
985
+ </p>
986
+
987
+ <ul>
988
+
989
+ <li>
990
+ Viewing in a narrow terminal or file manager preview pane
991
+ </li>
992
+
993
+ <li>
994
+ Apex cannot detect the pane width (e.g. in <strong>lf</strong> or <strong>yazi</strong> preview)
995
+ </li>
996
+
997
+ </ul>
998
+
999
+ <p>
1000
+ <strong>N</strong> must be a positive integer. If omitted or set to 0, Apex does not add wrapping; the terminal controls line breaks.
1001
+ </p>
1002
+
1003
+ <p>
1004
+ <strong>Examples:</strong>
1005
+ </p>
1006
+
1007
+ <div class="highlight">
1008
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal<span class="w"> </span>--width<span class="w"> </span><span class="m">80</span>
1009
+ apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>--width<span class="w"> </span><span class="m">72</span>
1010
+ </pre>
1011
+ </div>
1012
+
1013
+ <h3 Aliases id="code-highlight-theme-theme">
1014
+ <code>--code-highlight-theme&nbsp;THEME</code>
1015
+ </h3>
1016
+
1017
+ <p>
1018
+ When using an external syntax highlighter (via <code>--code-highlight</code>), you can control the highlighting theme with <code>--code-highlight-theme</code>. The same theme name is applied consistently to HTML and terminal output:
1019
+ </p>
1020
+
1021
+ <ul>
1022
+
1023
+ <li>
1024
+ <strong>Pygments</strong>: maps to <code>style=THEME</code> for both HTML and terminal/terminal256 ANSI output
1025
+ </li>
1026
+
1027
+ <li>
1028
+ <strong>Skylighting</strong>: maps to <code>--style THEME</code> for both HTML and ANSI output
1029
+ </li>
1030
+
1031
+ <li>
1032
+ <strong>Shiki</strong>: maps to <code>--theme THEME</code> for both HTML and ANSI output
1033
+ </li>
1034
+
1035
+ </ul>
1036
+
1037
+ <p>
1038
+ For <code>-t terminal</code> / <code>-t terminal256</code>, Apex uses the highlighter’s ANSI output when available, so your code blocks in the terminal use the selected theme’s colors.
1039
+ </p>
1040
+
1041
+ <div class="highlight">
1042
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal<span class="w"> </span>--code-highlight<span class="w"> </span>pygments<span class="w"> </span>--code-highlight-theme<span class="w"> </span>monokai
1043
+ apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>--code-highlight<span class="w"> </span>shiki<span class="w"> </span>--code-highlight-theme<span class="w"> </span>github-dark
1044
+ </pre>
1045
+ </div>
1046
+
1047
+ <h3 Description id="list-themes">
1048
+ <code>--list-themes</code>
1049
+ </h3>
1050
+
1051
+ <p>
1052
+ List available syntax highlighting themes for Pygments, Skylighting, and Shiki. The output is arranged in multiple columns that adapt to the current terminal width (up to four columns on wide screens).
1053
+ </p>
1054
+
1055
+ <div class="highlight">
1056
+ <pre><span></span>apex<span class="w"> </span>--list-themes
1057
+ </pre>
1058
+ </div>
1059
+
1060
+ <p>
1061
+ Use this together with <code>--code-highlight-theme</code> to discover theme names that look good in your terminal.
1062
+ </p>
1063
+
1064
+ <h3 id="p-paginate">
1065
+ <code>-p,&nbsp;--paginate</code>
1066
+ </h3>
1067
+
1068
+ <p>
1069
+ When using <code>-t terminal</code>, <code>-t cli</code>, or <code>-t terminal256</code>, <code>-p</code> / <code>--paginate</code> sends the rendered terminal output through a pager instead of writing directly to stdout.
1070
+ </p>
1071
+
1072
+ <p>
1073
+ <strong>Pager selection order:</strong>
1074
+ </p>
1075
+
1076
+ <ul>
1077
+
1078
+ <li>
1079
+ If <code>$APEX_PAGER</code> is set and non-empty, Apex uses its value as the pager
1080
+ </li>
1081
+
1082
+ <li>
1083
+ Otherwise, if <code>$PAGER</code> is set and non-empty, Apex uses that
1084
+ </li>
1085
+
1086
+ <li>
1087
+ Otherwise, Apex falls back to <code>less -R</code>
1088
+ </li>
1089
+
1090
+ </ul>
1091
+
1092
+ <p>
1093
+ Pagination is ignored when the output format is not a terminal format or when <code>-o/--output</code> is used to write to a file.
1094
+ </p>
1095
+
1096
+ <p>
1097
+ <strong>Pager vs. inline graphics:</strong> <code>less -R</code> and most pagers understand ANSI <strong>color</strong> sequences only—not iTerm inline-image protocols (<code>]1337;…</code>), Kitty graphics, or similar. When <code>paginate: true</code> (or <code>-p</code>) is active and the document contains inline graphics output, Apex <strong>automatically skips the pager</strong> and writes directly to stdout (with a one-line notice on stderr).
1098
+ </p>
1099
+
1100
+ <p>
1101
+ To paginate documents <strong>with images</strong>, use <strong><code>--paginate-symbols</code></strong> or <strong><code>paginate: symbols</code></strong> instead (see below).
1102
+ </p>
1103
+
1104
+ <div class="highlight">
1105
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal<span class="w"> </span>--paginate
1106
+ <span class="nv">APEX_PAGER</span><span class="o">=</span><span class="s2">&quot;less -RFX&quot;</span><span class="w"> </span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>-p
1107
+ </pre>
1108
+ </div>
1109
+
1110
+ <h3 **terminal** id="paginate-symbols">
1111
+ <code>--paginate-symbols</code>
1112
+ </h3>
1113
+
1114
+ <p>
1115
+ Page terminal output <strong>and</strong> render images as <strong>chafa</strong> ANSI block art (<code>chafa -f symbols</code>). This output is compatible with <strong><code>less -R</code></strong> and typical pagers.
1116
+ </p>
1117
+
1118
+ <ul>
1119
+
1120
+ <li>
1121
+ Requires <strong>chafa</strong> on <code>PATH</code>
1122
+ </li>
1123
+
1124
+ <li>
1125
+ With <code>-t terminal256</code>, uses <code>chafa -c 256</code>; with <code>-t terminal</code>, uses <code>chafa -c 16</code>
1126
+ </li>
1127
+
1128
+ <li>
1129
+ Equivalent to metadata <code>paginate: symbols</code>
1130
+ </li>
1131
+
1132
+ </ul>
1133
+
1134
+ <div class="highlight">
1135
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>--paginate-symbols
1136
+ </pre>
1137
+ </div>
1138
+
1139
+ <h3 **cli** id="no-paginate">
1140
+ <code>--no-paginate</code>
1141
+ </h3>
1142
+
1143
+ <p>
1144
+ Disable pagination for this run. Overrides <code>-p</code>, <code>--paginate-symbols</code>, and <code>paginate: true</code> / <code>paginate: symbols</code> from config or metadata.
1145
+ </p>
1146
+
1147
+ <div class="highlight">
1148
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>--no-paginate
1149
+ </pre>
1150
+ </div>
1151
+
1152
+ <h2 8/16-color ANSI output (standard and bright colors). Best compatibility with basic terminals. id="inline-images-terminal-graphics">
1153
+ Inline images (terminal&nbsp;graphics)
1154
+ </h2>
1155
+
1156
+ <p>
1157
+ When <strong><code>stdout</code> is a TTY</strong> and inline images are enabled, Apex can render <code>![alt](url)</code> images as graphics in the terminal instead of link-style text.
1158
+ </p>
1159
+
1160
+ <p>
1161
+ <strong>Viewer selection</strong> (when <strong>not</strong> using <code>--paginate-symbols</code> / <code>paginate: symbols</code>):
1162
+ </p>
1163
+
1164
+ <table>
1165
+
1166
+ <thead>
1167
+
1168
+ <tr>
1169
+
1170
+ <th>
1171
+ Priority
1172
+ </th>
1173
+
1174
+ <th>
1175
+ Tool
1176
+ </th>
1177
+
1178
+ <th>
1179
+ When used
1180
+ </th>
1181
+
1182
+ </tr>
1183
+
1184
+ </thead>
1185
+
1186
+ <tbody>
1187
+
1188
+ <tr>
1189
+
1190
+ <td>
1191
+ 1
1192
+ </td>
1193
+
1194
+ <td>
1195
+ <strong>imgcat</strong>
1196
+ </td>
1197
+
1198
+ <td>
1199
+ Only when <strong>TERM_PROGRAM</strong> indicates iTerm2 (iTerm inline-image protocol)
1200
+ </td>
1201
+
1202
+ </tr>
1203
+ <tr>
1204
+
1205
+ <td>
1206
+ 2
1207
+ </td>
1208
+
1209
+ <td>
1210
+ <strong>chafa</strong>
1211
+ </td>
1212
+
1213
+ <td>
1214
+ Otherwise, if on <code>PATH</code> (<code>-f iterm</code> on iTerm/WezTerm, <code>-f kitty</code> on Kitty, <code>-f symbols</code> on other terminals)
1215
+ </td>
1216
+
1217
+ </tr>
1218
+ <tr>
1219
+
1220
+ <td>
1221
+ 3
1222
+ </td>
1223
+
1224
+ <td>
1225
+ <strong>catimg</strong>
1226
+ </td>
1227
+
1228
+ <td>
1229
+ If chafa is not found
1230
+ </td>
1231
+
1232
+ </tr>
1233
+ <tr>
1234
+
1235
+ <td>
1236
+ 4
1237
+ </td>
1238
+
1239
+ <td>
1240
+ <strong>viu</strong>
1241
+ </td>
1242
+
1243
+ <td>
1244
+ If neither chafa nor catimg is found
1245
+ </td>
1246
+
1247
+ </tr>
1248
+ </tbody>
1249
+
1250
+ </table>
1251
+
1252
+ <p>
1253
+ With <strong><code>--paginate-symbols</code></strong> or <strong><code>paginate: symbols</code></strong>, Apex always uses <strong>chafa</strong> with <strong><code>-f symbols</code></strong> so images work inside <strong><code>less -R</code></strong>.
1254
+ </p>
1255
+
1256
+ <p>
1257
+ <strong>Width:</strong> Use <strong><code>--terminal-image-width N</code></strong> to set the maximum width in character cells (default <strong>50</strong>). This is separate from <strong><code>--width</code></strong>, which wraps prose.
1258
+ </p>
1259
+
1260
+ <p>
1261
+ <strong>Remote HTTP(S) images:</strong> If <strong><code>curl</code></strong> is on <strong><code>PATH</code></strong>, Apex downloads the image to a temporary file under <strong><code>TMPDIR</code></strong> or <strong><code>/tmp</code></strong>, displays it, then deletes the temp file. Downloads use a <strong>60 second</strong> timeout and reject files larger than <strong>10 MiB</strong>. If <strong><code>curl</code></strong> is missing or the download fails, Apex falls back to link-style output (see below).
1262
+ </p>
1263
+
1264
+ <p>
1265
+ <strong>When images are not drawn inline:</strong> Apex emits <strong>link-style</strong> output (styled alt text and the URL in parentheses), matching how normal links look in terminal output—not <code>![...](...)</code> markdown. That happens when:
1266
+ </p>
1267
+
1268
+ <ul>
1269
+
1270
+ <li>
1271
+ Output is <strong>not</strong> a TTY (e.g. piped to a file or another command)
1272
+ </li>
1273
+
1274
+ <li>
1275
+ <strong><code>--no-terminal-images</code></strong> is set
1276
+ </li>
1277
+
1278
+ <li>
1279
+ No supported viewer is installed, or the viewer exits with an error
1280
+ </li>
1281
+
1282
+ <li>
1283
+ A <strong>local</strong> path does not resolve to a readable file
1284
+ </li>
1285
+
1286
+ <li>
1287
+ A <strong>remote</strong> URL cannot be fetched within the limits above
1288
+ </li>
1289
+
1290
+ </ul>
1291
+
1292
+ <p>
1293
+ <strong>Captions:</strong> After an inline image, a caption line may show the file basename, optional image <code>title</code>, and alt text (subject to <strong><code>title_captions_only</code></strong> / <code>--title-captions-only</code> behavior for links).
1294
+ </p>
1295
+
1296
+ <h3 id="no-terminal-images">
1297
+ <code>--no-terminal-images</code>
1298
+ </h3>
1299
+
1300
+ <p>
1301
+ Disables inline terminal rendering of images. Images always use the link-style fallback.
1302
+ </p>
1303
+
1304
+ <div class="highlight">
1305
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal<span class="w"> </span>--no-terminal-images
1306
+ </pre>
1307
+ </div>
1308
+
1309
+ <h3 id="terminal-image-width-n">
1310
+ <code>--terminal-image-width&nbsp;N</code>
1311
+ </h3>
1312
+
1313
+ <p>
1314
+ Sets the maximum width in <strong>character cells</strong> for the terminal image tools (default <strong>50</strong>).
1315
+ </p>
1316
+
1317
+ <div class="highlight">
1318
+ <pre><span></span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>--terminal-image-width<span class="w"> </span><span class="m">72</span>
1319
+ </pre>
1320
+ </div>
1321
+
1322
+ <h2 id="configuration-and-metadata">
1323
+ Configuration and&nbsp;metadata
1324
+ </h2>
1325
+
1326
+ <p>
1327
+ Terminal behavior can be set via document metadata or a config file (e.g. <code>--meta-file</code>), so you don’t have to pass flags every time.
1328
+ </p>
1329
+
1330
+ <p>
1331
+ <strong>Precedence:</strong> CLI flags override metadata/config. For width: <strong>CLI <code>--width</code></strong> &gt; <strong>metadata/config <code>terminal.width</code></strong>. For terminal inline images: <strong><code>--no-terminal-images</code></strong> forces images to link-style output; <strong><code>--terminal-image-width</code></strong> overrides <strong><code>terminal.image_width</code></strong> when given.
1332
+ </p>
1333
+
1334
+ <h3 id="metadata-keys">
1335
+ Metadata&nbsp;keys
1336
+ </h3>
1337
+
1338
+ <p>
1339
+ Use a <code>terminal:</code> mapping in YAML front matter (or flattened keys in your metadata):
1340
+ </p>
1341
+
1342
+ <table>
1343
+
1344
+ <thead>
1345
+
1346
+ <tr>
1347
+
1348
+ <th>
1349
+ Key
1350
+ </th>
1351
+
1352
+ <th>
1353
+ Example
1354
+ </th>
1355
+
1356
+ <th>
1357
+ Description
1358
+ </th>
1359
+
1360
+ </tr>
1361
+
1362
+ </thead>
1363
+
1364
+ <tbody>
1365
+
1366
+ <tr>
1367
+
1368
+ <td>
1369
+ <strong>terminal.theme</strong> or <strong>terminal_theme</strong>
1370
+ </td>
1371
+
1372
+ <td>
1373
+ <code>brett</code>
1374
+ </td>
1375
+
1376
+ <td>
1377
+ Default terminal theme name for <code>-t terminal</code> / <code>-t terminal256</code>.
1378
+ </td>
1379
+
1380
+ </tr>
1381
+ <tr>
1382
+
1383
+ <td>
1384
+ <strong>terminal.width</strong> or <strong>terminal_width</strong>
1385
+ </td>
1386
+
1387
+ <td>
1388
+ <code>80</code>
1389
+ </td>
1390
+
1391
+ <td>
1392
+ Default wrap width (positive integer).
1393
+ </td>
1394
+
1395
+ </tr>
1396
+ <tr>
1397
+
1398
+ <td>
1399
+ <strong>terminal.inline_images</strong> or <strong>terminal_inline_images</strong>
1400
+ </td>
1401
+
1402
+ <td>
1403
+ <code>true</code>
1404
+ </td>
1405
+
1406
+ <td>
1407
+ Enable (<code>true</code>) or disable (<code>false</code>) inline terminal image rendering when a viewer is available (default: enabled in the API; use metadata to turn off per document).
1408
+ </td>
1409
+
1410
+ </tr>
1411
+ <tr>
1412
+
1413
+ <td>
1414
+ <strong>terminal.image_width</strong> or <strong>terminal_image_width</strong>
1415
+ </td>
1416
+
1417
+ <td>
1418
+ <code>50</code>
1419
+ </td>
1420
+
1421
+ <td>
1422
+ Default max width in character cells for image tools (see <strong>Inline images</strong> above).
1423
+ </td>
1424
+
1425
+ </tr>
1426
+ <tr>
1427
+
1428
+ <td>
1429
+ <strong>paginate</strong> / <strong>terminal.paginate</strong> / <strong>terminal_paginate</strong>
1430
+ </td>
1431
+
1432
+ <td>
1433
+ <code>true</code>, <code>false</code>, or <code>symbols</code>
1434
+ </td>
1435
+
1436
+ <td>
1437
+ <code>true</code> page via pager (skip pager if inline graphics detected). <code>symbols</code>: page and use chafa ANSI art for images. <code>false</code>: no pagination.
1438
+ </td>
1439
+
1440
+ </tr>
1441
+ <tr>
1442
+
1443
+ <td>
1444
+ <strong>code-highlight</strong> or <strong>code_highlight</strong>
1445
+ </td>
1446
+
1447
+ <td>
1448
+ <code>pygments</code>
1449
+ </td>
1450
+
1451
+ <td>
1452
+ Default external syntax highlighter for code blocks (Pygments, Skylighting, Shiki, or abbreviations).
1453
+ </td>
1454
+
1455
+ </tr>
1456
+ <tr>
1457
+
1458
+ <td>
1459
+ <strong>code-highlight-theme</strong> or <strong>code_highlight_theme</strong>
1460
+ </td>
1461
+
1462
+ <td>
1463
+ <code>monokai</code>
1464
+ </td>
1465
+
1466
+ <td>
1467
+ Default syntax highlighting theme for both HTML and terminal output.
1468
+ </td>
1469
+
1470
+ </tr>
1471
+ </tbody>
1472
+
1473
+ </table>
1474
+
1475
+ <p>
1476
+ <strong>Example with pagination and pager-friendly images:</strong>
1477
+ </p>
1478
+
1479
+ <div class="highlight">
1480
+ <pre><span></span><span class="nn">---</span>
1481
+ <span class="nt">paginate</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">symbols</span>
1482
+ <span class="nt">terminal</span><span class="p">:</span>
1483
+ <span class="w"> </span><span class="nt">theme</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">brett</span>
1484
+ <span class="w"> </span><span class="nt">width</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">80</span>
1485
+ <span class="nn">---</span>
1486
+ </pre>
1487
+ </div>
1488
+
1489
+ <p>
1490
+ <strong>Example in document front matter:</strong>
1491
+ </p>
1492
+
1493
+ <div class="highlight">
1494
+ <pre><span></span><span class="nn">---</span>
1495
+ <span class="nt">title</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">My Doc</span>
1496
+ <span class="nt">terminal</span><span class="p">:</span>
1497
+ <span class="w"> </span><span class="nt">theme</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">brett</span>
1498
+ <span class="w"> </span><span class="nt">width</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">80</span>
1499
+ <span class="nt">paginate</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
1500
+ <span class="nt">code-highlight</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pygments</span>
1501
+ <span class="nt">code-highlight-theme</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">monokai</span>
1502
+ <span class="nn">---</span>
1503
+ </pre>
1504
+ </div>
1505
+
1506
+ <p>
1507
+ <strong>Example in a shared config file</strong> (e.g. <code>config.yml</code> passed with <code>--meta-file</code>):
1508
+ </p>
1509
+
1510
+ <div class="highlight">
1511
+ <pre><span></span><span class="nt">terminal</span><span class="p">:</span>
1512
+ <span class="w"> </span><span class="nt">theme</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">dark</span>
1513
+ <span class="w"> </span><span class="nt">width</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">72</span>
1514
+ </pre>
1515
+ </div>
1516
+
1517
+ <p>
1518
+ If you set <strong><code>--theme</code></strong> or <strong><code>--width</code></strong> on the command line, those values override the metadata/config.
1519
+ </p>
1520
+
1521
+ <h2 id="theme-file-format">
1522
+ Theme file&nbsp;format
1523
+ </h2>
1524
+
1525
+ <p>
1526
+ Theme files live under <code>~/.config/apex/terminal/themes/</code> and use the <strong><code>.theme</code></strong> extension. They are plain YAML.
1527
+ </p>
1528
+
1529
+ <h3 **terminal256** id="location-and-naming">
1530
+ Location&nbsp;and&nbsp;naming
1531
+ </h3>
1532
+
1533
+ <ul>
1534
+
1535
+ <li>
1536
+ Path: <strong><code>~/.config/apex/terminal/themes/&lt;NAME&gt;.theme</code></strong>
1537
+ </li>
1538
+
1539
+ <li>
1540
+ <strong><code>default.theme</code></strong> is used when no theme name is provided (and no <code>--theme</code> is given).
1541
+ </li>
1542
+
1543
+ </ul>
1544
+
1545
+ <h3 — id="element-keys">
1546
+ Element&nbsp;keys
1547
+ </h3>
1548
+
1549
+ <p>
1550
+ Common top-level keys:
1551
+ </p>
1552
+
1553
+ <ul>
1554
+
1555
+ <li>
1556
+ <strong>h1</strong> … <strong>h6</strong> – Heading levels (each can have <code>color</code> and optional <code>bold: true</code>).
1557
+ </li>
1558
+
1559
+ <li>
1560
+ <strong>link</strong> – Link text and optional <code>link.url</code> for the URL style.
1561
+ </li>
1562
+
1563
+ <li>
1564
+ <strong>code_span</strong> – Inline code.
1565
+ </li>
1566
+
1567
+ <li>
1568
+ <strong>code_block</strong> – Fenced code blocks.
1569
+ </li>
1570
+
1571
+ <li>
1572
+ <strong>blockquote</strong> – Blockquote marker and text color (<code>blockquote.character</code>, <code>blockquote.color</code>).
1573
+ </li>
1574
+
1575
+ <li>
1576
+ <strong>table</strong> – Table border/style (<code>table.border</code>, optional <code>table.bold</code>).
1577
+ </li>
1578
+
1579
+ <li>
1580
+ <strong>list_marker</strong> – Style for bullet and numbered list markers (e.g. <code>*</code>, <code>1.</code>, <code>2.</code>). When unset, markers use <strong>bold bright red</strong>.
1581
+ </li>
1582
+
1583
+ </ul>
1584
+
1585
+ <p>
1586
+ For any element that has a <strong>color</strong> field, you can add <strong><code>bold: true</code></strong> to make that element bold in addition to its color.
1587
+ </p>
1588
+
1589
+ <h3 256-color ANSI output (xterm-256 palette). Richer colors when your terminal supports it. id="example-theme-excerpt">
1590
+ Example theme&nbsp;(excerpt)
1591
+ </h3>
1592
+
1593
+ <div class="highlight">
1594
+ <pre><span></span><span class="nt">h1</span><span class="p">:</span>
1595
+ <span class="w"> </span><span class="nt">color</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;bright_white&quot;</span>
1596
+ <span class="w"> </span><span class="nt">bold</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
1597
+
1598
+ <span class="nt">h2</span><span class="p">:</span>
1599
+ <span class="w"> </span><span class="nt">color</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;bright_blue&quot;</span>
1600
+ <span class="w"> </span><span class="nt">bold</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
1601
+
1602
+ <span class="nt">list_marker</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;b</span><span class="nv"> </span><span class="s">intense_red&quot;</span>
1603
+
1604
+ <span class="nt">code_span</span><span class="p">:</span>
1605
+ <span class="w"> </span><span class="nt">color</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;b</span><span class="nv"> </span><span class="s">white</span><span class="nv"> </span><span class="s">on_intense_black&quot;</span>
1606
+
1607
+ <span class="nt">code_block</span><span class="p">:</span>
1608
+ <span class="w"> </span><span class="nt">color</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;white</span><span class="nv"> </span><span class="s">on_black&quot;</span>
1609
+ <span class="w"> </span><span class="nt">bold</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
1610
+ </pre>
1611
+ </div>
1612
+
1613
+ <p>
1614
+ Color values can use names like <strong>red</strong>, <strong>bright_blue</strong>, <strong>intense_red</strong>, and 256-color forms like <strong>38;5;nnn</strong>. The <strong>b</strong> prefix (or <strong>bold: true</strong> in structured keys) enables bold. See existing themes in the repo or in <code>~/.config/apex/terminal/themes/</code> for more examples.
1615
+ </p>
1616
+
1617
+ <h2 id="debugging-terminal-output">
1618
+ Debugging terminal&nbsp;output
1619
+ </h2>
1620
+
1621
+ <p>
1622
+ Set <strong><code>APEX_DEBUG_TERMINAL=1</code></strong> to print diagnostics to stderr: selected image viewer, full viewer command lines, <code>TERM_PROGRAM</code>, pagination mode (<code>paginate</code> / <code>paginate_symbols</code>), and syntax highlighter commands.
1623
+ </p>
1624
+
1625
+ <div class="highlight">
1626
+ <pre><span></span><span class="nv">APEX_DEBUG_TERMINAL</span><span class="o">=</span><span class="m">1</span><span class="w"> </span>apex<span class="w"> </span>doc.md<span class="w"> </span>-t<span class="w"> </span>terminal256<span class="w"> </span>--paginate-symbols
1627
+ </pre>
1628
+ </div>
1629
+
1630
+ <h2 id="typical-use-cases">
1631
+ Typical&nbsp;use&nbsp;cases
1632
+ </h2>
1633
+
1634
+ <ul>
1635
+
1636
+ <li>
1637
+ <strong>Interactive reading (no images):</strong> <code>apex doc.md -t terminal | less -R</code> or <code>apex doc.md -t terminal -p</code>
1638
+ </li>
1639
+
1640
+ <li>
1641
+ <strong>Interactive reading (with images in pager):</strong> <code>apex doc.md -t terminal256 --paginate-symbols</code>
1642
+ </li>
1643
+
1644
+ <li>
1645
+ <strong>Full-quality inline graphics (no pager):</strong> <code>apex doc.md -t terminal256 --no-paginate</code>
1646
+ </li>
1647
+
1648
+ <li>
1649
+ <strong>File manager preview (lf, yazi, etc.):</strong> Use <code>-t terminal</code> or <code>-t terminal256</code> and <code>--width</code> set to your preview pane width (e.g. <code>--width 80</code>), or set <code>terminal.width</code> in metadata/config.
1650
+ </li>
1651
+
1652
+ <li>
1653
+ <strong>Consistent look:</strong> Create a <code>.theme</code> file and reference it with <code>--theme</code> or <code>terminal.theme</code> in metadata so all your terminal renders use the same colors and emphasis.
1654
+ </li>
1655
+
1656
+ </ul>
1657
+
1658
+ <h2 id="replacing-mdless-and-similar-tools">
1659
+ Replacing mdless and similar&nbsp;tools
1660
+ </h2>
1661
+
1662
+ <p>
1663
+ If you are used to tools like <code>mdless</code>, you can use Apex as a drop-in replacement and keep all of your preferred colors, width, and pagination settings in one place.
1664
+ </p>
1665
+
1666
+ <p>
1667
+ One simple approach is a shell alias with pager-friendly images:
1668
+ </p>
1669
+
1670
+ <div class="highlight">
1671
+ <pre><span></span><span class="nb">alias</span><span class="w"> </span><span class="nv">mdless</span><span class="o">=</span><span class="s1">&#39;apex -t terminal256 --paginate-symbols --code-highlight pygments --code-highlight-theme monokai --width 60 --theme mdless&#39;</span>
1672
+ </pre>
1673
+ </div>
1674
+
1675
+ <p>
1676
+ For full-resolution inline graphics (iTerm, Kitty, etc.), omit pagination:
1677
+ </p>
1678
+
1679
+ <div class="highlight">
1680
+ <pre><span></span><span class="nb">alias</span><span class="w"> </span><span class="nv">mdless</span><span class="o">=</span><span class="s1">&#39;apex -t terminal256 --no-paginate --code-highlight pygments --code-highlight-theme monokai --width 60 --theme mdless&#39;</span>
1681
+ </pre>
1682
+ </div>
1683
+
1684
+ <p>
1685
+ You can then run:
1686
+ </p>
1687
+
1688
+ <div class="highlight">
1689
+ <pre><span></span>mdless<span class="w"> </span>README.md
1690
+ </pre>
1691
+ </div>
1692
+
1693
+ <p>
1694
+ Most of these options can also be moved into config or metadata so the alias stays short:
1695
+ </p>
1696
+
1697
+ <div class="highlight">
1698
+ <pre><span></span><span class="nt">terminal</span><span class="p">:</span>
1699
+ <span class="w"> </span><span class="nt">theme</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">brett</span>
1700
+ <span class="w"> </span><span class="nt">width</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">60</span>
1701
+ <span class="nt">paginate</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">symbols</span>
1702
+ <span class="nt">code-highlight</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pygments</span>
1703
+ <span class="nt">code-highlight-theme</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">monokai</span>
1704
+ </pre>
1705
+ </div>
1706
+
1707
+ <p>
1708
+ With this configuration, the alias can be as simple as:
1709
+ </p>
1710
+
1711
+ <div class="highlight">
1712
+ <pre><span></span><span class="nb">alias</span><span class="w"> </span><span class="nv">mdless</span><span class="o">=</span><span class="s1">&#39;apex -t terminal256&#39;</span>
1713
+ </pre>
1714
+ </div>
1715
+
1716
+ <p>
1717
+ For pagination without images (or prose-only docs), use <code>paginate: true</code> instead of <code>paginate: symbols</code>. With <code>paginate: true</code>, Apex auto-skips the pager when inline graphics are detected.
1718
+ </p>
1719
+
1720
+ <h2 id="see-also">
1721
+ See&nbsp;also
1722
+ </h2>
1723
+
1724
+ <ul>
1725
+
1726
+ <li>
1727
+ <a href="Command-Line-Options.html">Command Line Options</a> – Full list of CLI flags, including <code>-t</code>/<code>--to</code>, <code>--theme</code>, and <code>--width</code>.
1728
+ </li>
1729
+
1730
+ <li>
1731
+ <a href="Configuration.html">Configuration</a> – Config file and metadata behavior.
1732
+ </li>
1733
+
1734
+ </ul>
1735
+
1736
+ <script>
1737
+ // Hamburger menu functionality
1738
+ (function() {
1739
+ function initHamburgerMenu() {
1740
+ var hamburger = document.getElementById('hamburger-menu');
1741
+ var sidebar = document.querySelector('.main-toc, .sidebar');
1742
+ var overlay = document.getElementById('mobile-menu-overlay');
1743
+
1744
+ if (!hamburger || !sidebar) return;
1745
+
1746
+ function toggleMenu() {
1747
+ var isOpen = sidebar.classList.contains('mobile-open');
1748
+ if (isOpen) {
1749
+ sidebar.classList.remove('mobile-open');
1750
+ hamburger.classList.remove('active');
1751
+ if (overlay) overlay.classList.remove('active');
1752
+ } else {
1753
+ sidebar.classList.add('mobile-open');
1754
+ hamburger.classList.add('active');
1755
+ if (overlay) overlay.classList.add('active');
1756
+ }
1757
+ }
1758
+
1759
+ hamburger.addEventListener('click', function(e) {
1760
+ e.stopPropagation();
1761
+ toggleMenu();
1762
+ });
1763
+
1764
+ if (overlay) {
1765
+ overlay.addEventListener('click', function() {
1766
+ toggleMenu();
1767
+ });
1768
+ }
1769
+
1770
+ // Close menu when clicking on a sidebar link (mobile only)
1771
+ if (window.innerWidth <= 768) {
1772
+ var sidebarLinks = sidebar.querySelectorAll('a');
1773
+ sidebarLinks.forEach(function(link) {
1774
+ link.addEventListener('click', function() {
1775
+ setTimeout(function() {
1776
+ sidebar.classList.remove('mobile-open');
1777
+ hamburger.classList.remove('active');
1778
+ if (overlay) overlay.classList.remove('active');
1779
+ }, 100);
1780
+ });
1781
+ });
1782
+ }
1783
+
1784
+ // Close menu on window resize if going to desktop
1785
+ window.addEventListener('resize', function() {
1786
+ if (window.innerWidth > 768) {
1787
+ sidebar.classList.remove('mobile-open');
1788
+ hamburger.classList.remove('active');
1789
+ if (overlay) overlay.classList.remove('active');
1790
+ }
1791
+ });
1792
+ }
1793
+
1794
+ // Initialize when DOM is ready
1795
+ if (document.readyState === 'loading') {
1796
+ document.addEventListener('DOMContentLoaded', initHamburgerMenu);
1797
+ } else {
1798
+ initHamburgerMenu();
1799
+ }
1800
+ })();
1801
+
1802
+ </script>
1803
+ <script>
1804
+ (function() {
1805
+ // Clone the page TOC for floating TOC
1806
+ function initFloatingTOC() {
1807
+ var pageTOC = document.getElementById('page-toc-top');
1808
+ var floatingTOCContent = document.getElementById('floating-toc-content');
1809
+ var floatingTOC = document.getElementById('floating-toc');
1810
+
1811
+ if (!pageTOC || !floatingTOCContent || !floatingTOC) return;
1812
+
1813
+ // Clone the TOC structure
1814
+ var tocClone = pageTOC.cloneNode(true);
1815
+ tocClone.id = 'floating-toc-clone';
1816
+ floatingTOCContent.appendChild(tocClone);
1817
+
1818
+ // Update all links to use smooth scrolling
1819
+ var allTOCLinks = document.querySelectorAll('.page-toc a, .floating-toc-content a');
1820
+ allTOCLinks.forEach(function(link) {
1821
+ link.addEventListener('click', function(e) {
1822
+ var href = this.getAttribute('href');
1823
+ if (href && href.startsWith('#')) {
1824
+ e.preventDefault();
1825
+ var targetId = href.substring(1);
1826
+ var targetElement = document.getElementById(targetId);
1827
+ if (targetElement) {
1828
+ var offset = 20; // Offset from top
1829
+
1830
+ // Function to calculate absolute position from document top
1831
+ function getAbsoluteTop(element) {
1832
+ var top = 0;
1833
+ while (element) {
1834
+ top += element.offsetTop;
1835
+ element = element.offsetParent;
1836
+ }
1837
+ return top;
1838
+ }
1839
+
1840
+ var absoluteTop = getAbsoluteTop(targetElement);
1841
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
1842
+ var offsetPosition = absoluteTop - offset;
1843
+
1844
+ // Only scroll if we're not already at the target position
1845
+ if (Math.abs(scrollTop - offsetPosition) > 10) {
1846
+ window.scrollTo({
1847
+ top: Math.max(0, offsetPosition),
1848
+ behavior: 'smooth'
1849
+ });
1850
+ }
1851
+
1852
+ // Update URL hash without triggering scroll
1853
+ if (history.pushState) {
1854
+ history.pushState(null, null, href);
1855
+ }
1856
+ }
1857
+ }
1858
+ });
1859
+ });
1860
+
1861
+ // Handle scroll to show/hide floating TOC
1862
+ var tocTop = pageTOC.getBoundingClientRect().top + window.pageYOffset;
1863
+ var tocBottom = tocTop + pageTOC.offsetHeight;
1864
+
1865
+ function updateFloatingTOC() {
1866
+ var scrollY = window.pageYOffset || document.documentElement.scrollTop;
1867
+
1868
+ if (scrollY > tocBottom) {
1869
+ floatingTOC.classList.add('visible');
1870
+ } else {
1871
+ floatingTOC.classList.remove('visible');
1872
+ }
1873
+ }
1874
+
1875
+ // Throttle scroll events
1876
+ var ticking = false;
1877
+ window.addEventListener('scroll', function() {
1878
+ if (!ticking) {
1879
+ window.requestAnimationFrame(function() {
1880
+ updateFloatingTOC();
1881
+ ticking = false;
1882
+ });
1883
+ ticking = true;
1884
+ }
1885
+ });
1886
+
1887
+ // Initial check
1888
+ updateFloatingTOC();
1889
+ }
1890
+
1891
+ // Initialize when DOM is ready
1892
+ if (document.readyState === 'loading') {
1893
+ document.addEventListener('DOMContentLoaded', initFloatingTOC);
1894
+ } else {
1895
+ initFloatingTOC();
1896
+ }
1897
+ })();
1898
+ </script>
1899
+ <footer class="page-footer"><p>Copyright 2025 Brett Terpstra, All Rights Reserved | MIT License</p></footer></body>
1900
+
1901
+ </html>
1902
+