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
@@ -20,9 +20,9 @@ typedef struct cmark_node cmark_node;
20
20
  #endif
21
21
 
22
22
  #define APEX_VERSION_MAJOR 1
23
- #define APEX_VERSION_MINOR 0
24
- #define APEX_VERSION_PATCH 4
25
- #define APEX_VERSION_STRING "1.0.4"
23
+ #define APEX_VERSION_MINOR 1
24
+ #define APEX_VERSION_PATCH 20
25
+ #define APEX_VERSION_STRING "1.1.20"
26
26
 
27
27
  /**
28
28
  * Processor compatibility modes
@@ -34,10 +34,21 @@ typedef enum {
34
34
  APEX_MODE_GFM = 1, /* GitHub Flavored Markdown */
35
35
  APEX_MODE_MULTIMARKDOWN = 2, /* MultiMarkdown compatibility */
36
36
  APEX_MODE_KRAMDOWN = 3, /* Kramdown compatibility */
37
- APEX_MODE_UNIFIED = 4 /* All features enabled */
37
+ APEX_MODE_UNIFIED = 4, /* All features enabled */
38
+ APEX_MODE_QUARTO = 5 /* Pandoc/Quarto markdown (HTML-oriented) */
38
39
  } apex_mode_t;
39
40
  #endif
40
41
 
42
+ /** True for unified and quarto processor modes. */
43
+ static inline bool apex_mode_is_unified_family(apex_mode_t mode) {
44
+ return mode == APEX_MODE_UNIFIED || mode == APEX_MODE_QUARTO;
45
+ }
46
+
47
+ /** True for kramdown, unified, or quarto processor modes. */
48
+ static inline bool apex_mode_is_kramdown_or_unified_family(apex_mode_t mode) {
49
+ return mode == APEX_MODE_KRAMDOWN || apex_mode_is_unified_family(mode);
50
+ }
51
+
41
52
  /**
42
53
  * Output format options
43
54
  */
@@ -53,9 +64,21 @@ typedef enum {
53
64
  APEX_OUTPUT_TERMINAL = 8, /* ANSI terminal output (8/16-color) */
54
65
  APEX_OUTPUT_TERMINAL256 = 9, /* ANSI terminal output (256-color) */
55
66
  APEX_OUTPUT_MAN = 10, /* roff (man page source) */
56
- APEX_OUTPUT_MAN_HTML = 11 /* styled HTML man page */
67
+ APEX_OUTPUT_MAN_HTML = 11, /* styled HTML man page */
68
+ APEX_OUTPUT_TOC = 12, /* Markdown TOC list only */
69
+ APEX_OUTPUT_RTF = 13 /* Rich Text Format */
57
70
  } apex_output_format_t;
58
71
 
72
+ /**
73
+ * Flat TOC entry for structured outlines (Swift/ObjC table views, etc.).
74
+ * level is 1-6; text and id are heap-owned when returned from Apex APIs.
75
+ */
76
+ typedef struct apex_toc_entry {
77
+ int level;
78
+ char *text;
79
+ char *id;
80
+ } apex_toc_entry;
81
+
59
82
  /* Markdown dialects for AST->Markdown serialization. */
60
83
  #ifndef APEX_MARKDOWN_DIALECT_DEFINED
61
84
  #define APEX_MARKDOWN_DIALECT_DEFINED
@@ -109,9 +132,22 @@ typedef struct apex_options {
109
132
  bool enable_task_lists;
110
133
  bool enable_attributes;
111
134
  bool enable_callouts;
135
+ bool enable_py_callouts; /* Enable Python-Markdown !!! callout preprocessing */
136
+ bool enable_quarto_callouts; /* Enable Quarto ::: callout preprocessing */
137
+ bool enable_quarto_extensions; /* Enable Pandoc/Quarto-specific preprocessors ({=raw}, example lists, etc.) */
138
+ bool enable_quarto_raw; /* Enable {=format} raw content preprocessing */
139
+ bool enable_quarto_example_lists; /* Enable (@) example list markers (quarto-list-continuation) */
140
+ bool enable_quarto_line_blocks; /* Enable | line blocks */
141
+ bool enable_quarto_roman_lists; /* Enable i) ii) roman list markers */
142
+ bool enable_quarto_code_attrs; /* Enable ```{.lang attr="val"} fence attributes */
143
+ bool enable_quarto_diagrams; /* Enable Quarto diagram fences ({mermaid}, {dot}, {graphviz}) */
144
+ bool enable_quarto_shortcodes; /* Enable Quarto shortcode shim ({{< ... >}}) */
145
+ bool enable_quarto_strict_lists; /* Require blank line before list blocks (Pandoc strict) */
146
+ bool enable_quarto_xrefs; /* Wrap @fig-/@sec- cross-refs in span.quarto-xref */
112
147
  bool enable_marked_extensions;
113
- bool enable_divs; /* Enable Pandoc fenced divs (Unified mode only) */
148
+ bool enable_divs; /* Enable Pandoc fenced divs (unified/quarto modes) */
114
149
  bool enable_spans; /* Enable bracketed spans [text]{IAL} (Pandoc-style) */
150
+ bool enable_grid_tables; /* Enable Pandoc grid table syntax (preprocess to pipe tables) */
115
151
 
116
152
  /* Critic markup mode */
117
153
  int critic_mode; /* 0=markup (default), 1=accept, 2=reject */
@@ -143,6 +179,7 @@ typedef struct apex_options {
143
179
  const char *theme_name; /* Optional terminal theme name (for -t terminal/terminal256) */
144
180
  int terminal_width; /* Optional fixed wrapping width for terminal output (0 = auto / none) */
145
181
  bool paginate; /* When true and output_format is terminal/terminal256, page output via pager */
182
+ bool paginate_symbols; /* When paginating, render images as chafa ANSI symbols (less -R compatible) */
146
183
  bool terminal_inline_images; /* When true, render local images via imgcat/chafa/viu/catimg on a TTY */
147
184
  int terminal_image_width; /* Max width/cells for terminal image tools (default 50; 0 = use 50) */
148
185
 
@@ -155,6 +192,17 @@ typedef struct apex_options {
155
192
  bool header_anchors; /* Generate <a> anchor tags instead of header IDs */
156
193
  int id_format; /* 0=GFM (with dashes), 1=MMD (no dashes) */
157
194
 
195
+ /* TOC depth defaults (used by -t toc and by HTML TOC markers without an explicit range) */
196
+ int toc_min; /* Inclusive min heading level (default 1) */
197
+ int toc_max; /* Inclusive max heading level (default 3) */
198
+
199
+ /* Optional structured TOC capture (normally NULL). Prefer apex_markdown_to_toc_entries().
200
+ * When both are non-NULL and output_format is APEX_OUTPUT_TOC, apex_markdown_to_html
201
+ * fills *toc_entries_out / *toc_entries_count_out (free with apex_toc_entries_free)
202
+ * and returns an empty string. */
203
+ apex_toc_entry **toc_entries_out;
204
+ size_t *toc_entries_count_out;
205
+
158
206
  /* Table options */
159
207
  bool relaxed_tables; /* Support tables without separator rows (kramdown/unified only) */
160
208
  int caption_position; /* 0=above, 1=below (default: 1=below) */
@@ -195,6 +243,7 @@ typedef struct apex_options {
195
243
  bool enable_leanpub_index_syntax; /* Enable Leanpub {i: "term"} syntax */
196
244
  bool suppress_index; /* Suppress index output */
197
245
  bool group_index_by_letter; /* Group index entries by first letter */
246
+ char **concordance_files; /* NULL-terminated TextIndex concordance TSV paths */
198
247
 
199
248
  /* Wiki link options */
200
249
  int wikilink_space; /* Space replacement: 0=dash, 1=none, 2=underscore, 3=space */
@@ -291,6 +340,7 @@ char *apex_cmark_to_markdown(cmark_node *document,
291
340
  apex_markdown_dialect_t dialect);
292
341
  char *apex_cmark_to_man_roff(cmark_node *document, const struct apex_options *options);
293
342
  char *apex_cmark_to_man_html(cmark_node *document, const struct apex_options *options);
343
+ char *apex_cmark_to_rtf(cmark_node *document, const struct apex_options *options);
294
344
 
295
345
  /**
296
346
  * Get default options for a specific mode
@@ -298,6 +348,17 @@ char *apex_cmark_to_man_html(cmark_node *document, const struct apex_options *op
298
348
  apex_options apex_options_default(void);
299
349
  apex_options apex_options_for_mode(apex_mode_t mode);
300
350
 
351
+ /**
352
+ * Load metadata from an external file and apply it to options.
353
+ * Supports the same YAML, Pandoc, and MultiMarkdown formats as the CLI.
354
+ * String fields populated by this function are heap-allocated copies. The
355
+ * caller may leave them allocated for the process lifetime or free each field
356
+ * individually after the final conversion that uses these options.
357
+ * @return true on success; false if options or path is NULL, path is empty,
358
+ * the file cannot be loaded, or ownership copies cannot be allocated.
359
+ */
360
+ bool apex_options_apply_meta_file(apex_options *options, const char *path);
361
+
301
362
  /**
302
363
  * Main conversion function: Markdown to HTML
303
364
  *
@@ -308,6 +369,31 @@ apex_options apex_options_for_mode(apex_mode_t mode);
308
369
  */
309
370
  char *apex_markdown_to_html(const char *markdown, size_t len, const apex_options *options);
310
371
 
372
+ /**
373
+ * Collect document headings as a flat array of TOC entries.
374
+ * Honors id_format, min/max levels, and .no_toc the same as -t toc.
375
+ * @param out_count Receives entry count (may be 0); required
376
+ * @return Heap array of count entries, or NULL if out_count is NULL / allocation fails.
377
+ * Free with apex_toc_entries_free().
378
+ */
379
+ apex_toc_entry *apex_generate_toc_entries(cmark_node *document, int id_format,
380
+ int min_level, int max_level,
381
+ size_t *out_count);
382
+
383
+ /**
384
+ * Parse markdown and return structured TOC entries (same pipeline as -t toc).
385
+ * Uses options->toc_min / toc_max / id_format (defaults apply when options is NULL).
386
+ * Free the result with apex_toc_entries_free().
387
+ */
388
+ apex_toc_entry *apex_markdown_to_toc_entries(const char *markdown, size_t len,
389
+ const apex_options *options,
390
+ size_t *out_count);
391
+
392
+ /**
393
+ * Free an array returned by apex_generate_toc_entries / apex_markdown_to_toc_entries.
394
+ */
395
+ void apex_toc_entries_free(apex_toc_entry *entries, size_t count);
396
+
311
397
  /**
312
398
  * Resolve a local image path against base_directory (same rules as HTML embedding).
313
399
  * Returns a newly allocated path, or NULL on allocation failure.
@@ -0,0 +1,23 @@
1
+ #ifndef APEX_AST_RTF_H
2
+ #define APEX_AST_RTF_H
3
+
4
+ #include "cmark-gfm.h"
5
+
6
+ /* Forward declaration of options struct; full typedef lives in apex.h */
7
+ struct apex_options;
8
+
9
+ #ifdef __cplusplus
10
+ extern "C" {
11
+ #endif
12
+
13
+ /**
14
+ * Serialize a cmark document to Rich Text Format (RTF).
15
+ * Returns a newly allocated string (caller frees with free/apex_free_string).
16
+ */
17
+ char *apex_cmark_to_rtf(cmark_node *document, const struct apex_options *options);
18
+
19
+ #ifdef __cplusplus
20
+ }
21
+ #endif
22
+
23
+ #endif
@@ -32,6 +32,12 @@ char *apex_cmark_to_terminal(cmark_node *document,
32
32
  const struct apex_options *options,
33
33
  bool use_256);
34
34
 
35
+ /**
36
+ * Byte length of the most recent apex_cmark_to_terminal() result.
37
+ * Use instead of strlen() because inline image escape sequences may contain NUL bytes.
38
+ */
39
+ size_t apex_terminal_output_length(void);
40
+
35
41
  #ifdef __cplusplus
36
42
  }
37
43
  #endif
@@ -1,5 +1,6 @@
1
1
  module ApexHeaders {
2
2
  umbrella header "apex.h"
3
+ header "plugins.h"
3
4
  explicit module parser {
4
5
  header "parser.h"
5
6
  export *
@@ -20,5 +21,9 @@ module ApexHeaders {
20
21
  header "ast_man.h"
21
22
  export *
22
23
  }
24
+ explicit module ast_rtf {
25
+ header "ast_rtf.h"
26
+ export *
27
+ }
23
28
  export *
24
29
  }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Apex plugin catalog and installation API.
3
+ *
4
+ * Fetch available plugins from the central directory, list installed plugins,
5
+ * and install or uninstall plugins into the user-global plugins directory.
6
+ */
7
+
8
+ #ifndef APEX_PLUGINS_PUBLIC_H
9
+ #define APEX_PLUGINS_PUBLIC_H
10
+
11
+ #include <stddef.h>
12
+ #include <stdbool.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ /** Default URL for apex-plugins.json (ApexMarkdown/apex-plugins). */
19
+ #define APEX_PLUGIN_DIRECTORY_URL \
20
+ "https://raw.githubusercontent.com/ApexMarkdown/apex-plugins/refs/heads/main/apex-plugins.json"
21
+
22
+ /** One plugin entry (catalog or installed). String fields are owned by the catalog. */
23
+ typedef struct apex_plugin_info {
24
+ char *id;
25
+ char *title;
26
+ char *description;
27
+ char *author;
28
+ char *homepage;
29
+ char *repo;
30
+ } apex_plugin_info;
31
+
32
+ /** Array of plugin entries. */
33
+ typedef struct apex_plugin_catalog {
34
+ apex_plugin_info *items;
35
+ size_t count;
36
+ } apex_plugin_catalog;
37
+
38
+ /** Options for discovering installed plugins (same precedence as runtime loading). */
39
+ typedef struct apex_plugin_discovery_options {
40
+ /** Optional document/project base directory for .apex/plugins lookup. */
41
+ const char *base_directory;
42
+ /** Include project-scoped dirs (cwd, base_directory, git root). Default true when NULL opts. */
43
+ bool include_project;
44
+ /** Include user-global ~/.config/apex/plugins. Default true when NULL opts. */
45
+ bool include_user_global;
46
+ } apex_plugin_discovery_options;
47
+
48
+ /** Options for apex_plugin_install(). */
49
+ typedef struct apex_plugin_install_options {
50
+ /** Allow install by Git URL or user/repo shorthand (not in the directory). */
51
+ bool allow_untrusted_repo;
52
+ /** Run post_install from plugin.yml after clone. Default true when NULL opts. */
53
+ bool run_post_install;
54
+ } apex_plugin_install_options;
55
+
56
+ /**
57
+ * Fetch the plugin catalog from a JSON directory URL.
58
+ * @return New catalog (caller must free with apex_plugin_catalog_free), or NULL on failure.
59
+ */
60
+ apex_plugin_catalog *apex_plugin_catalog_fetch_url(const char *url);
61
+
62
+ /** Fetch the catalog from APEX_PLUGIN_DIRECTORY_URL. */
63
+ apex_plugin_catalog *apex_plugin_catalog_fetch_default(void);
64
+
65
+ /** Free a catalog returned by fetch or list functions. */
66
+ void apex_plugin_catalog_free(apex_plugin_catalog *catalog);
67
+
68
+ /**
69
+ * List installed plugins using the same discovery order as apex_plugins_load().
70
+ * @return New catalog, or NULL on failure.
71
+ */
72
+ apex_plugin_catalog *apex_plugins_list_installed(
73
+ const apex_plugin_discovery_options *options);
74
+
75
+ /**
76
+ * Resolve the user-global plugins directory (~/.config/apex/plugins or XDG).
77
+ * @return 0 on success, -1 if buffer too small or HOME unset.
78
+ */
79
+ int apex_plugin_global_directory(char *buf, size_t buflen);
80
+
81
+ /**
82
+ * Install a plugin by directory id or Git URL / GitHub shorthand.
83
+ * Installs into the user-global plugins directory.
84
+ * @param error_buf Optional buffer for an error message (may be NULL).
85
+ * @return 0 on success, -1 on failure.
86
+ */
87
+ int apex_plugin_install(const char *id_or_repo,
88
+ const apex_plugin_install_options *options,
89
+ char *error_buf,
90
+ size_t error_buf_len);
91
+
92
+ /**
93
+ * Remove an installed plugin from the user-global plugins directory.
94
+ * Does not remove support data under apex/support/<id>/.
95
+ * @return 0 on success, -1 on failure.
96
+ */
97
+ int apex_plugin_uninstall(const char *id,
98
+ char *error_buf,
99
+ size_t error_buf_len);
100
+
101
+ #ifdef __cplusplus
102
+ }
103
+ #endif
104
+
105
+ #endif /* APEX_PLUGINS_PUBLIC_H */
@@ -2,5 +2,6 @@
2
2
  #define APEXC_H
3
3
 
4
4
  #include <apex/apex.h>
5
+ #include <apex/plugins.h>
5
6
 
6
7
  #endif /* APEXC_H */