apex-ruby 1.0.17 → 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,1656 @@
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="filters">
838
+ Filters
839
+ </h1>
840
+ <nav class="page-toc" id="page-toc-top"><ul><li><a href="#filters">Filters</a><ul><li><a href="#enabling-filters">Enabling&nbsp;filters</a><ul><li><a href="#environment-and-protocol">Environment and&nbsp;protocol</a></li></ul></li><li><a href="#lua-filters">Lua&nbsp;filters</a><ul><li><a href="#requirements">Requirements</a></li><li><a href="#writing-a-lua-filter">Writing a&nbsp;Lua&nbsp;filter</a></li><li><a href="#minimal-example">Minimal&nbsp;example</a></li></ul></li><li><a href="#user-filter-directory">User filter&nbsp;directory</a><ul><li><a href="#example-title-filter-ruby">Example: Title filter&nbsp;(Ruby)</a></li><li><a href="#example-delink-filter-python">Example: Delink filter&nbsp;(Python)</a></li></ul></li><li><a href="#multiple-filters-and-ordering">Multiple filters and&nbsp;ordering</a></li><li><a href="#relationship-to-plugins">Relationship&nbsp;to&nbsp;plugins</a></li></ul></li></ul></nav>
841
+
842
+ <p>
843
+ Apex supports <strong>AST-level filters</strong> that operate on a Pandoc-compatible JSON
844
+ representation of the document, similar to <a href="https://pandoc.org/filters.html#summary">Pandoc filters</a>.
845
+ </p>
846
+
847
+ <p>
848
+ Filters let you:
849
+ </p>
850
+
851
+ <ul>
852
+
853
+ <li>
854
+ Walk and transform the document structure (blocks and inlines) in <em>any</em> language.
855
+ </li>
856
+
857
+ <li>
858
+ Apply custom formatting rules, content checks, or structural changes.
859
+ </li>
860
+
861
+ <li>
862
+ Reuse existing Pandoc JSON filter ecosystems (Python, Ruby, Node, etc.).
863
+ </li>
864
+
865
+ </ul>
866
+
867
+ <p>
868
+ Under the hood, Apex:
869
+ </p>
870
+
871
+ <ol>
872
+
873
+ <li>
874
+ Parses Markdown using <strong>cmark-gfm</strong> into its internal AST.
875
+ </li>
876
+
877
+ <li>
878
+ Converts that AST to a <strong>Pandoc-style JSON AST</strong>.
879
+ </li>
880
+
881
+ <li>
882
+ Pipes the JSON through one or more external filters.
883
+ </li>
884
+
885
+ <li>
886
+ Parses the transformed JSON back into a cmark AST and renders to HTML.
887
+ </li>
888
+
889
+ </ol>
890
+
891
+ <div class="highlight">
892
+ <pre><span></span>markdown → cmark AST → Pandoc JSON → filters → Pandoc JSON → cmark AST → HTML
893
+ </pre>
894
+ </div>
895
+
896
+ <h2 id="enabling-filters">
897
+ Enabling&nbsp;filters
898
+ </h2>
899
+
900
+ <p>
901
+ Filters are configured via the Apex CLI:
902
+ </p>
903
+
904
+ <ul>
905
+
906
+ <li>
907
+
908
+ <p>
909
+ <code>--filter NAME</code>
910
+ </p>
911
+
912
+ <ul>
913
+
914
+ <li>
915
+ Run a single filter from your user filters directory:
916
+ <ul>
917
+
918
+ <li>
919
+ <code>$XDG_CONFIG_HOME/apex/filters/NAME</code>, or
920
+ </li>
921
+
922
+ <li>
923
+ <code>~/.config/apex/filters/NAME</code> (on macOS/Linux when XDG is not set).
924
+ </li>
925
+
926
+ </ul>
927
+
928
+ </li>
929
+
930
+ <li>
931
+ <code>NAME</code> should be an executable script/binary that implements the
932
+ Pandoc JSON filter contract.
933
+ </li>
934
+
935
+ </ul>
936
+
937
+ </li>
938
+
939
+ <li>
940
+
941
+ <p>
942
+ <code>--filters</code>
943
+ </p>
944
+
945
+ <ul>
946
+
947
+ <li>
948
+ Run <strong>all executable files</strong> in the filters directory, sorted by name.
949
+ </li>
950
+
951
+ <li>
952
+ Useful for assembling a standard filter pipeline (e.g. <code>01-title</code>, <code>10-delink</code>, etc.).
953
+ </li>
954
+
955
+ </ul>
956
+
957
+ </li>
958
+
959
+ <li>
960
+
961
+ <p>
962
+ <code>--lua-filter FILE</code>
963
+ </p>
964
+
965
+ <ul>
966
+
967
+ <li>
968
+ Run a Lua script as an AST filter via the system <code>lua</code> interpreter.
969
+ </li>
970
+
971
+ <li>
972
+ Internally Apex invokes <code>lua &quot;FILE&quot;</code> as a JSON filter, so your script
973
+ should read a Pandoc JSON document from stdin and write JSON to stdout.
974
+ </li>
975
+
976
+ </ul>
977
+
978
+ </li>
979
+
980
+ <li>
981
+
982
+ <p>
983
+ <code>--no-strict-filters</code>
984
+ </p>
985
+
986
+ <ul>
987
+
988
+ <li>
989
+ By default, filters are <strong>strict</strong>:
990
+ <ul>
991
+
992
+ <li>
993
+ If a filter exits with a non-zero status or produces invalid JSON,
994
+ Apex aborts the conversion with an error.
995
+ </li>
996
+
997
+ </ul>
998
+
999
+ </li>
1000
+
1001
+ <li>
1002
+ With <code>--no-strict-filters</code>, Apex:
1003
+ <ul>
1004
+
1005
+ <li>
1006
+ Logs a warning and <strong>skips</strong> the failing filter,
1007
+ </li>
1008
+
1009
+ <li>
1010
+ Continues processing with the previous AST.
1011
+ </li>
1012
+
1013
+ </ul>
1014
+
1015
+ </li>
1016
+
1017
+ </ul>
1018
+
1019
+ </li>
1020
+
1021
+ </ul>
1022
+
1023
+ <h3 id="environment-and-protocol">
1024
+ Environment and&nbsp;protocol
1025
+ </h3>
1026
+
1027
+ <p>
1028
+ Each filter is executed as a separate process:
1029
+ </p>
1030
+
1031
+ <ul>
1032
+
1033
+ <li>
1034
+
1035
+ <p>
1036
+ <strong>Input</strong>:
1037
+ </p>
1038
+
1039
+ <ul>
1040
+
1041
+ <li>
1042
+ Apex writes a single Pandoc JSON document to the filter’s <code>stdin</code>.
1043
+ </li>
1044
+
1045
+ <li>
1046
+ This document has:
1047
+ <ul>
1048
+
1049
+ <li>
1050
+ <code>pandoc-api-version</code> field,
1051
+ </li>
1052
+
1053
+ <li>
1054
+ <code>meta</code> (document metadata),
1055
+ </li>
1056
+
1057
+ <li>
1058
+ <code>blocks</code> (list of block elements).
1059
+ </li>
1060
+
1061
+ </ul>
1062
+
1063
+ </li>
1064
+
1065
+ </ul>
1066
+
1067
+ </li>
1068
+
1069
+ <li>
1070
+
1071
+ <p>
1072
+ <strong>Output</strong>:
1073
+ </p>
1074
+
1075
+ <ul>
1076
+
1077
+ <li>
1078
+ The filter writes a (possibly transformed) Pandoc JSON document to <code>stdout</code>.
1079
+ </li>
1080
+
1081
+ <li>
1082
+ Apex uses the result as the input AST for the next filter, or for rendering.
1083
+ </li>
1084
+
1085
+ </ul>
1086
+
1087
+ </li>
1088
+
1089
+ </ul>
1090
+
1091
+ <p>
1092
+ This is identical in spirit to Pandoc’s JSON filter model
1093
+ (<a href="https://pandoc.org/filters.html#summary">Pandoc filters</a>), so libraries like
1094
+ <code>pandocfilters</code> (Python) or various language ports work unchanged.
1095
+ </p>
1096
+
1097
+ <h2 id="lua-filters">
1098
+ Lua&nbsp;filters
1099
+ </h2>
1100
+
1101
+ <p>
1102
+ <strong><code>--lua-filter FILE</code></strong> runs a Lua script as an AST filter. Apex invokes the
1103
+ system <code>lua</code> interpreter with the script path; the script receives a Pandoc
1104
+ JSON document on <strong>stdin</strong> and must write a (possibly transformed) Pandoc JSON
1105
+ document to <strong>stdout</strong>. No Pandoc-specific Lua runtime is required.
1106
+ </p>
1107
+
1108
+ <h3 id="requirements">
1109
+ Requirements
1110
+ </h3>
1111
+
1112
+ <ul>
1113
+
1114
+ <li>
1115
+ A Lua interpreter on your PATH (<code>lua</code>, <code>lua5.1</code>, <code>lua5.2</code>, <code>lua5.3</code>, or
1116
+ <code>lua5.4</code>).
1117
+ </li>
1118
+
1119
+ <li>
1120
+ A JSON library for Lua (e.g. <strong>dkjson</strong>), since Lua has no built-in JSON
1121
+ support. Install dkjson with LuaRocks:
1122
+ <div class="highlight">
1123
+ <pre><span></span>brew<span class="w"> </span>install<span class="w"> </span>luarocks<span class="w"> </span><span class="c1"># macOS/Homebrew</span>
1124
+ luarocks<span class="w"> </span>install<span class="w"> </span>dkjson
1125
+ </pre>
1126
+ </div>
1127
+
1128
+ </li>
1129
+
1130
+ </ul>
1131
+
1132
+ <h3 id="writing-a-lua-filter">
1133
+ Writing a&nbsp;Lua&nbsp;filter
1134
+ </h3>
1135
+
1136
+ <ol>
1137
+
1138
+ <li>
1139
+ Read the full document from stdin (e.g. in 4KB chunks and concatenate).
1140
+ </li>
1141
+
1142
+ <li>
1143
+ Decode the JSON (e.g. <code>dkjson.decode</code>).
1144
+ </li>
1145
+
1146
+ <li>
1147
+ Walk and transform the <code>blocks</code> (and optionally <code>meta</code>) as needed. Block
1148
+ and inline objects use <code>t</code> (type) and <code>c</code> (content); Apex accepts keys in
1149
+ any order (e.g. <code>&quot;c&quot;</code> before <code>&quot;t&quot;</code> as emitted by dkjson).
1150
+ </li>
1151
+
1152
+ <li>
1153
+ Encode the result back to JSON and write it to stdout (e.g. <code>dkjson.encode</code>).
1154
+ </li>
1155
+
1156
+ </ol>
1157
+
1158
+ <h3 id="minimal-example">
1159
+ Minimal&nbsp;example
1160
+ </h3>
1161
+
1162
+ <div class="highlight">
1163
+ <pre><span></span><span class="kd">local</span><span class="w"> </span><span class="nv">json</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">require</span><span class="p">(</span><span class="s2">&quot;dkjson&quot;</span><span class="p">)</span>
1164
+
1165
+ <span class="kd">local</span><span class="w"> </span><span class="nv">input</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">io.read</span><span class="p">(</span><span class="s2">&quot;*a&quot;</span><span class="p">)</span>
1166
+ <span class="kd">local</span><span class="w"> </span><span class="nv">doc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">json</span><span class="p">.</span><span class="nf">decode</span><span class="p">(</span><span class="nv">input</span><span class="p">)</span>
1167
+ <span class="kr">if</span><span class="w"> </span><span class="ow">not</span><span class="w"> </span><span class="nv">doc</span><span class="w"> </span><span class="kr">then</span>
1168
+ <span class="w"> </span><span class="nb">io.stderr</span><span class="p">:</span><span class="nf">write</span><span class="p">(</span><span class="s2">&quot;Invalid JSON</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
1169
+ <span class="w"> </span><span class="nb">os.exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
1170
+ <span class="kr">end</span>
1171
+
1172
+ <span class="c1">-- Optional: transform doc.blocks or doc.meta</span>
1173
+ <span class="c1">-- doc.blocks = ...</span>
1174
+
1175
+ <span class="nb">io.write</span><span class="p">(</span><span class="nv">json</span><span class="p">.</span><span class="nf">encode</span><span class="p">(</span><span class="nv">doc</span><span class="p">))</span>
1176
+ </pre>
1177
+ </div>
1178
+
1179
+ <p>
1180
+ Use it:
1181
+ </p>
1182
+
1183
+ <div class="highlight">
1184
+ <pre><span></span>apex<span class="w"> </span>--lua-filter<span class="w"> </span>myfilter.lua<span class="w"> </span>input.md<span class="w"> </span>&gt;<span class="w"> </span>output.html
1185
+ </pre>
1186
+ </div>
1187
+
1188
+ <p>
1189
+ For a full example that rewrites blocks (e.g. unwrapping paragraphs into raw
1190
+ HTML), see the <a href="https://github.com/ApexMarkdown/apex-filter-unwrap">apex-filter-unwrap</a>
1191
+ repository.
1192
+ </p>
1193
+
1194
+ <h2 id="user-filter-directory">
1195
+ User filter&nbsp;directory
1196
+ </h2>
1197
+
1198
+ <p>
1199
+ On macOS/Linux, Apex looks for filters in:
1200
+ </p>
1201
+
1202
+ <ul>
1203
+
1204
+ <li>
1205
+ <code>$XDG_CONFIG_HOME/apex/filters</code> (if set), or
1206
+ </li>
1207
+
1208
+ <li>
1209
+ <code>~/.config/apex/filters</code>
1210
+ </li>
1211
+
1212
+ </ul>
1213
+
1214
+ <p>
1215
+ Use <code>apex --list-filters</code> to see installed filters and those available from the <a href="https://github.com/ApexMarkdown/apex-filters">apex-filters</a> directory; use <code>apex --install-filter ID</code> and <code>apex --uninstall-filter ID</code> to install or remove a filter by ID. See <a href="Command-Line-Options.html">Command-Line Options</a> for details.
1216
+ </p>
1217
+
1218
+ <p>
1219
+ Each filter is just an executable file in that directory:
1220
+ </p>
1221
+
1222
+ <div class="highlight">
1223
+ <pre><span></span>~/.config/apex/filters/
1224
+ title # Ruby script
1225
+ delink # Python script
1226
+ ...
1227
+ </pre>
1228
+ </div>
1229
+
1230
+ <h3 id="example-title-filter-ruby">
1231
+ Example: Title filter&nbsp;(Ruby)
1232
+ </h3>
1233
+
1234
+ <p>
1235
+ This filter:
1236
+ </p>
1237
+
1238
+ <ul>
1239
+
1240
+ <li>
1241
+ Reads a Pandoc JSON document from stdin.
1242
+ </li>
1243
+
1244
+ <li>
1245
+ Reads <code>meta.title</code>.
1246
+ </li>
1247
+
1248
+ <li>
1249
+ If the first block is not already an H1, prepends a <code>Header 1</code> with the title.
1250
+ </li>
1251
+
1252
+ </ul>
1253
+
1254
+ <div class="highlight">
1255
+ <pre><span></span><span class="ch">#!/usr/bin/env ruby</span>
1256
+
1257
+ <span class="nb">require</span><span class="w"> </span><span class="s2">&quot;json&quot;</span>
1258
+
1259
+ <span class="n">doc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="no">JSON</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="vg">$stdin</span><span class="o">.</span><span class="n">read</span><span class="p">)</span>
1260
+ <span class="n">blocks</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">doc</span><span class="o">[</span><span class="s2">&quot;blocks&quot;</span><span class="o">]</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="o">[]</span>
1261
+ <span class="n">meta</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">doc</span><span class="o">[</span><span class="s2">&quot;meta&quot;</span><span class="o">]</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{}</span>
1262
+
1263
+ <span class="n">title_text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kp">nil</span>
1264
+
1265
+ <span class="k">if</span><span class="w"> </span><span class="n">meta</span><span class="o">.</span><span class="n">key?</span><span class="p">(</span><span class="s2">&quot;title&quot;</span><span class="p">)</span>
1266
+ <span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">meta</span><span class="o">[</span><span class="s2">&quot;title&quot;</span><span class="o">]</span>
1267
+ <span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="n">t</span><span class="o">[</span><span class="s2">&quot;t&quot;</span><span class="o">]</span>
1268
+ <span class="w"> </span><span class="k">when</span><span class="w"> </span><span class="s2">&quot;MetaString&quot;</span>
1269
+ <span class="w"> </span><span class="n">title_text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">t</span><span class="o">[</span><span class="s2">&quot;c&quot;</span><span class="o">].</span><span class="n">to_s</span>
1270
+ <span class="w"> </span><span class="k">when</span><span class="w"> </span><span class="s2">&quot;MetaInlines&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;MetaText&quot;</span>
1271
+ <span class="w"> </span><span class="n">inlines</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">t</span><span class="o">[</span><span class="s2">&quot;c&quot;</span><span class="o">]</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="o">[]</span>
1272
+ <span class="w"> </span><span class="n">title_text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">inlines</span><span class="o">.</span><span class="n">map</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">|</span><span class="n">inline</span><span class="o">|</span>
1273
+ <span class="w"> </span><span class="n">inline</span><span class="o">.</span><span class="n">is_a?</span><span class="p">(</span><span class="no">Hash</span><span class="p">)</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="n">inline</span><span class="o">[</span><span class="s2">&quot;t&quot;</span><span class="o">]</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">&quot;Str&quot;</span><span class="w"> </span><span class="p">?</span><span class="w"> </span><span class="n">inline</span><span class="o">[</span><span class="s2">&quot;c&quot;</span><span class="o">].</span><span class="n">to_s</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="kp">nil</span>
1274
+ <span class="w"> </span><span class="p">}</span><span class="o">.</span><span class="n">compact</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">&quot; &quot;</span><span class="p">)</span>
1275
+ <span class="w"> </span><span class="k">end</span>
1276
+ <span class="k">end</span>
1277
+
1278
+ <span class="k">if</span><span class="w"> </span><span class="n">title_text</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="o">!</span><span class="n">title_text</span><span class="o">.</span><span class="n">strip</span><span class="o">.</span><span class="n">empty?</span>
1279
+ <span class="w"> </span><span class="n">first</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">blocks</span><span class="o">.</span><span class="n">first</span>
1280
+ <span class="w"> </span><span class="n">already_h1</span><span class="w"> </span><span class="o">=</span>
1281
+ <span class="w"> </span><span class="n">first</span><span class="w"> </span><span class="o">&amp;&amp;</span>
1282
+ <span class="w"> </span><span class="n">first</span><span class="o">[</span><span class="s2">&quot;t&quot;</span><span class="o">]</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">&quot;Header&quot;</span><span class="w"> </span><span class="o">&amp;&amp;</span>
1283
+ <span class="w"> </span><span class="n">first</span><span class="o">[</span><span class="s2">&quot;c&quot;</span><span class="o">].</span><span class="n">is_a?</span><span class="p">(</span><span class="nb">Array</span><span class="p">)</span><span class="w"> </span><span class="o">&amp;&amp;</span>
1284
+ <span class="w"> </span><span class="n">first</span><span class="o">[</span><span class="s2">&quot;c&quot;</span><span class="o">][</span><span class="mi">0</span><span class="o">]</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">1</span>
1285
+
1286
+ <span class="w"> </span><span class="k">unless</span><span class="w"> </span><span class="n">already_h1</span>
1287
+ <span class="w"> </span><span class="n">header</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
1288
+ <span class="w"> </span><span class="s2">&quot;t&quot;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="s2">&quot;Header&quot;</span><span class="p">,</span>
1289
+ <span class="w"> </span><span class="s2">&quot;c&quot;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="o">[</span>
1290
+ <span class="w"> </span><span class="mi">1</span><span class="p">,</span>
1291
+ <span class="w"> </span><span class="o">[</span><span class="s2">&quot;&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">[]</span><span class="p">,</span><span class="w"> </span><span class="o">[]]</span><span class="p">,</span>
1292
+ <span class="w"> </span><span class="o">[</span><span class="p">{</span><span class="w"> </span><span class="s2">&quot;t&quot;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="s2">&quot;Str&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;c&quot;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">title_text</span><span class="w"> </span><span class="p">}</span><span class="o">]</span>
1293
+ <span class="w"> </span><span class="o">]</span>
1294
+ <span class="w"> </span><span class="p">}</span>
1295
+ <span class="w"> </span><span class="n">blocks</span><span class="o">.</span><span class="n">unshift</span><span class="p">(</span><span class="n">header</span><span class="p">)</span>
1296
+ <span class="w"> </span><span class="n">doc</span><span class="o">[</span><span class="s2">&quot;blocks&quot;</span><span class="o">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">blocks</span>
1297
+ <span class="w"> </span><span class="k">end</span>
1298
+ <span class="k">end</span>
1299
+
1300
+ <span class="nb">puts</span><span class="w"> </span><span class="no">JSON</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="n">doc</span><span class="p">)</span>
1301
+ </pre>
1302
+ </div>
1303
+
1304
+ <p>
1305
+ Install and use:
1306
+ </p>
1307
+
1308
+ <div class="highlight">
1309
+ <pre><span></span>mkdir<span class="w"> </span>-p<span class="w"> </span>~/.config/apex/filters
1310
+ cp<span class="w"> </span>title.rb<span class="w"> </span>~/.config/apex/filters/title
1311
+ chmod<span class="w"> </span>+x<span class="w"> </span>~/.config/apex/filters/title
1312
+
1313
+ apex<span class="w"> </span>--filter<span class="w"> </span>title<span class="w"> </span>input.md<span class="w"> </span>&gt;<span class="w"> </span>output.html
1314
+ </pre>
1315
+ </div>
1316
+
1317
+ <h3 id="example-delink-filter-python">
1318
+ Example: Delink filter&nbsp;(Python)
1319
+ </h3>
1320
+
1321
+ <p>
1322
+ This filter:
1323
+ </p>
1324
+
1325
+ <ul>
1326
+
1327
+ <li>
1328
+ Finds <code>Link</code> inlines:
1329
+ <ul>
1330
+
1331
+ <li>
1332
+ <code>{ &quot;t&quot;: &quot;Link&quot;, &quot;c&quot;: [Attr, [Inlines...], [url, title]] }</code>
1333
+ </li>
1334
+
1335
+ </ul>
1336
+
1337
+ </li>
1338
+
1339
+ <li>
1340
+ Replaces them with <code>Span</code> inlines that keep only the text:
1341
+ <ul>
1342
+
1343
+ <li>
1344
+ <code>{ &quot;t&quot;: &quot;Span&quot;, &quot;c&quot;: [Attr, [Inlines...]] }</code>
1345
+ </li>
1346
+
1347
+ </ul>
1348
+
1349
+ </li>
1350
+
1351
+ </ul>
1352
+
1353
+ <div class="highlight">
1354
+ <pre><span></span><span class="ch">#!/usr/bin/env python3</span>
1355
+
1356
+ <span class="kn">import</span><span class="w"> </span><span class="nn">json</span>
1357
+ <span class="kn">import</span><span class="w"> </span><span class="nn">sys</span>
1358
+
1359
+ <span class="k">def</span><span class="w"> </span><span class="nf">delink</span><span class="p">(</span><span class="n">node</span><span class="p">):</span>
1360
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="nb">dict</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;t&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="s2">&quot;Link&quot;</span><span class="p">:</span>
1361
+ <span class="n">c</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;c&quot;</span><span class="p">,</span> <span class="p">[])</span>
1362
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">c</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
1363
+ <span class="n">attr</span><span class="p">,</span> <span class="n">inlines</span><span class="p">,</span> <span class="n">_target</span> <span class="o">=</span> <span class="n">c</span>
1364
+ <span class="k">return</span> <span class="p">{</span><span class="s2">&quot;t&quot;</span><span class="p">:</span> <span class="s2">&quot;Span&quot;</span><span class="p">,</span> <span class="s2">&quot;c&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">attr</span><span class="p">,</span> <span class="n">inlines</span><span class="p">]}</span>
1365
+ <span class="k">return</span> <span class="n">node</span>
1366
+
1367
+ <span class="k">def</span><span class="w"> </span><span class="nf">walk</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
1368
+ <span class="n">x</span> <span class="o">=</span> <span class="n">delink</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
1369
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
1370
+ <span class="k">return</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">walk</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">x</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
1371
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
1372
+ <span class="k">return</span> <span class="p">[</span><span class="n">walk</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">x</span><span class="p">]</span>
1373
+ <span class="k">return</span> <span class="n">x</span>
1374
+
1375
+ <span class="k">def</span><span class="w"> </span><span class="nf">main</span><span class="p">():</span>
1376
+ <span class="n">data</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
1377
+ <span class="n">data</span> <span class="o">=</span> <span class="n">walk</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
1378
+ <span class="n">json</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="p">)</span>
1379
+
1380
+ <span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
1381
+ <span class="n">main</span><span class="p">()</span>
1382
+ </pre>
1383
+ </div>
1384
+
1385
+ <p>
1386
+ Install and use:
1387
+ </p>
1388
+
1389
+ <div class="highlight">
1390
+ <pre><span></span>mkdir<span class="w"> </span>-p<span class="w"> </span>~/.config/apex/filters
1391
+ cp<span class="w"> </span>delink.py<span class="w"> </span>~/.config/apex/filters/delink
1392
+ chmod<span class="w"> </span>+x<span class="w"> </span>~/.config/apex/filters/delink
1393
+
1394
+ apex<span class="w"> </span>--filter<span class="w"> </span>delink<span class="w"> </span>input.md<span class="w"> </span>&gt;<span class="w"> </span>output.html
1395
+ </pre>
1396
+ </div>
1397
+
1398
+ <h2 id="multiple-filters-and-ordering">
1399
+ Multiple filters and&nbsp;ordering
1400
+ </h2>
1401
+
1402
+ <p>
1403
+ You can compose filters in two ways:
1404
+ </p>
1405
+
1406
+ <ul>
1407
+
1408
+ <li>
1409
+
1410
+ <p>
1411
+ <strong>Multiple <code>--filter</code> flags</strong>:
1412
+ </p>
1413
+
1414
+ <div class="highlight">
1415
+ <pre><span></span>apex<span class="w"> </span>--filter<span class="w"> </span>title<span class="w"> </span>--filter<span class="w"> </span>delink<span class="w"> </span>input.md<span class="w"> </span>&gt;<span class="w"> </span>output.html
1416
+ </pre>
1417
+ </div>
1418
+
1419
+ <p>
1420
+ Filters run in the order they appear on the command line.
1421
+ </p>
1422
+
1423
+ </li>
1424
+
1425
+ <li>
1426
+
1427
+ <p>
1428
+ <strong><code>--filters</code> directory mode</strong>:
1429
+ </p>
1430
+
1431
+ <div class="highlight">
1432
+ <pre><span></span>apex<span class="w"> </span>--filters<span class="w"> </span>input.md<span class="w"> </span>&gt;<span class="w"> </span>output.html
1433
+ </pre>
1434
+ </div>
1435
+
1436
+ <p>
1437
+ All executable files in the filters directory are run in <strong>sorted
1438
+ filename order</strong>. You can control order via prefixes like <code>01-title</code>,
1439
+ <code>10-delink</code>, etc.
1440
+ </p>
1441
+
1442
+ </li>
1443
+
1444
+ </ul>
1445
+
1446
+ <p>
1447
+ You can also combine both:
1448
+ </p>
1449
+
1450
+ <div class="highlight">
1451
+ <pre><span></span>apex<span class="w"> </span>--filters<span class="w"> </span>--filter<span class="w"> </span>extra<span class="w"> </span>input.md<span class="w"> </span>&gt;<span class="w"> </span>output.html
1452
+ </pre>
1453
+ </div>
1454
+
1455
+ <p>
1456
+ Directory filters run first, followed by explicit <code>--filter</code> commands.
1457
+ </p>
1458
+
1459
+ <h2 id="relationship-to-plugins">
1460
+ Relationship&nbsp;to&nbsp;plugins
1461
+ </h2>
1462
+
1463
+ <p>
1464
+ Filters are <strong>AST-level</strong> and operate on Pandoc JSON between parse and render.
1465
+ </p>
1466
+
1467
+ <p>
1468
+ Plugins are:
1469
+ </p>
1470
+
1471
+ <ul>
1472
+
1473
+ <li>
1474
+ String-level pre-parse or post-render transformations.
1475
+ </li>
1476
+
1477
+ <li>
1478
+ Configured via plugin manifests and run through the plugin system
1479
+ (see <a href="Plugins.html">Plugins</a>).
1480
+ </li>
1481
+
1482
+ </ul>
1483
+
1484
+ <p>
1485
+ Use <strong>filters</strong> when you need structured transformations of the document tree
1486
+ or want to reuse Pandoc JSON filter tooling; use <strong>plugins</strong> when a simpler
1487
+ string pass (regex, external formatter, etc.) is enough.
1488
+ </p>
1489
+
1490
+ <script>
1491
+ // Hamburger menu functionality
1492
+ (function() {
1493
+ function initHamburgerMenu() {
1494
+ var hamburger = document.getElementById('hamburger-menu');
1495
+ var sidebar = document.querySelector('.main-toc, .sidebar');
1496
+ var overlay = document.getElementById('mobile-menu-overlay');
1497
+
1498
+ if (!hamburger || !sidebar) return;
1499
+
1500
+ function toggleMenu() {
1501
+ var isOpen = sidebar.classList.contains('mobile-open');
1502
+ if (isOpen) {
1503
+ sidebar.classList.remove('mobile-open');
1504
+ hamburger.classList.remove('active');
1505
+ if (overlay) overlay.classList.remove('active');
1506
+ } else {
1507
+ sidebar.classList.add('mobile-open');
1508
+ hamburger.classList.add('active');
1509
+ if (overlay) overlay.classList.add('active');
1510
+ }
1511
+ }
1512
+
1513
+ hamburger.addEventListener('click', function(e) {
1514
+ e.stopPropagation();
1515
+ toggleMenu();
1516
+ });
1517
+
1518
+ if (overlay) {
1519
+ overlay.addEventListener('click', function() {
1520
+ toggleMenu();
1521
+ });
1522
+ }
1523
+
1524
+ // Close menu when clicking on a sidebar link (mobile only)
1525
+ if (window.innerWidth <= 768) {
1526
+ var sidebarLinks = sidebar.querySelectorAll('a');
1527
+ sidebarLinks.forEach(function(link) {
1528
+ link.addEventListener('click', function() {
1529
+ setTimeout(function() {
1530
+ sidebar.classList.remove('mobile-open');
1531
+ hamburger.classList.remove('active');
1532
+ if (overlay) overlay.classList.remove('active');
1533
+ }, 100);
1534
+ });
1535
+ });
1536
+ }
1537
+
1538
+ // Close menu on window resize if going to desktop
1539
+ window.addEventListener('resize', function() {
1540
+ if (window.innerWidth > 768) {
1541
+ sidebar.classList.remove('mobile-open');
1542
+ hamburger.classList.remove('active');
1543
+ if (overlay) overlay.classList.remove('active');
1544
+ }
1545
+ });
1546
+ }
1547
+
1548
+ // Initialize when DOM is ready
1549
+ if (document.readyState === 'loading') {
1550
+ document.addEventListener('DOMContentLoaded', initHamburgerMenu);
1551
+ } else {
1552
+ initHamburgerMenu();
1553
+ }
1554
+ })();
1555
+
1556
+ </script>
1557
+ <script>
1558
+ (function() {
1559
+ // Clone the page TOC for floating TOC
1560
+ function initFloatingTOC() {
1561
+ var pageTOC = document.getElementById('page-toc-top');
1562
+ var floatingTOCContent = document.getElementById('floating-toc-content');
1563
+ var floatingTOC = document.getElementById('floating-toc');
1564
+
1565
+ if (!pageTOC || !floatingTOCContent || !floatingTOC) return;
1566
+
1567
+ // Clone the TOC structure
1568
+ var tocClone = pageTOC.cloneNode(true);
1569
+ tocClone.id = 'floating-toc-clone';
1570
+ floatingTOCContent.appendChild(tocClone);
1571
+
1572
+ // Update all links to use smooth scrolling
1573
+ var allTOCLinks = document.querySelectorAll('.page-toc a, .floating-toc-content a');
1574
+ allTOCLinks.forEach(function(link) {
1575
+ link.addEventListener('click', function(e) {
1576
+ var href = this.getAttribute('href');
1577
+ if (href && href.startsWith('#')) {
1578
+ e.preventDefault();
1579
+ var targetId = href.substring(1);
1580
+ var targetElement = document.getElementById(targetId);
1581
+ if (targetElement) {
1582
+ var offset = 20; // Offset from top
1583
+
1584
+ // Function to calculate absolute position from document top
1585
+ function getAbsoluteTop(element) {
1586
+ var top = 0;
1587
+ while (element) {
1588
+ top += element.offsetTop;
1589
+ element = element.offsetParent;
1590
+ }
1591
+ return top;
1592
+ }
1593
+
1594
+ var absoluteTop = getAbsoluteTop(targetElement);
1595
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
1596
+ var offsetPosition = absoluteTop - offset;
1597
+
1598
+ // Only scroll if we're not already at the target position
1599
+ if (Math.abs(scrollTop - offsetPosition) > 10) {
1600
+ window.scrollTo({
1601
+ top: Math.max(0, offsetPosition),
1602
+ behavior: 'smooth'
1603
+ });
1604
+ }
1605
+
1606
+ // Update URL hash without triggering scroll
1607
+ if (history.pushState) {
1608
+ history.pushState(null, null, href);
1609
+ }
1610
+ }
1611
+ }
1612
+ });
1613
+ });
1614
+
1615
+ // Handle scroll to show/hide floating TOC
1616
+ var tocTop = pageTOC.getBoundingClientRect().top + window.pageYOffset;
1617
+ var tocBottom = tocTop + pageTOC.offsetHeight;
1618
+
1619
+ function updateFloatingTOC() {
1620
+ var scrollY = window.pageYOffset || document.documentElement.scrollTop;
1621
+
1622
+ if (scrollY > tocBottom) {
1623
+ floatingTOC.classList.add('visible');
1624
+ } else {
1625
+ floatingTOC.classList.remove('visible');
1626
+ }
1627
+ }
1628
+
1629
+ // Throttle scroll events
1630
+ var ticking = false;
1631
+ window.addEventListener('scroll', function() {
1632
+ if (!ticking) {
1633
+ window.requestAnimationFrame(function() {
1634
+ updateFloatingTOC();
1635
+ ticking = false;
1636
+ });
1637
+ ticking = true;
1638
+ }
1639
+ });
1640
+
1641
+ // Initial check
1642
+ updateFloatingTOC();
1643
+ }
1644
+
1645
+ // Initialize when DOM is ready
1646
+ if (document.readyState === 'loading') {
1647
+ document.addEventListener('DOMContentLoaded', initFloatingTOC);
1648
+ } else {
1649
+ initFloatingTOC();
1650
+ }
1651
+ })();
1652
+ </script>
1653
+ <footer class="page-footer"><p>Copyright 2025 Brett Terpstra, All Rights Reserved | MIT License</p></footer></body>
1654
+
1655
+ </html>
1656
+