apex-ruby 1.0.6 → 1.0.7

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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/ext/apex_ext/apex_ext.c +6 -0
  3. data/ext/apex_ext/apex_src/AGENTS.md +41 -0
  4. data/ext/apex_ext/apex_src/CHANGELOG.md +412 -2
  5. data/ext/apex_ext/apex_src/CMakeLists.txt +41 -29
  6. data/ext/apex_ext/apex_src/Formula/apex.rb +2 -2
  7. data/ext/apex_ext/apex_src/Package.swift +9 -0
  8. data/ext/apex_ext/apex_src/README.md +31 -9
  9. data/ext/apex_ext/apex_src/ROADMAP.md +5 -0
  10. data/ext/apex_ext/apex_src/VERSION +1 -1
  11. data/ext/apex_ext/apex_src/cli/main.c +1125 -13
  12. data/ext/apex_ext/apex_src/docs/index.md +459 -0
  13. data/ext/apex_ext/apex_src/include/apex/apex.h +67 -5
  14. data/ext/apex_ext/apex_src/include/apex/ast_man.h +20 -0
  15. data/ext/apex_ext/apex_src/include/apex/ast_markdown.h +39 -0
  16. data/ext/apex_ext/apex_src/include/apex/ast_terminal.h +40 -0
  17. data/ext/apex_ext/apex_src/include/apex/module.modulemap +1 -1
  18. data/ext/apex_ext/apex_src/man/apex-config.5 +333 -258
  19. data/ext/apex_ext/apex_src/man/apex-config.5.md +3 -1
  20. data/ext/apex_ext/apex_src/man/apex-plugins.7 +401 -316
  21. data/ext/apex_ext/apex_src/man/apex.1 +663 -620
  22. data/ext/apex_ext/apex_src/man/apex.1.html +703 -0
  23. data/ext/apex_ext/apex_src/man/apex.1.md +160 -90
  24. data/ext/apex_ext/apex_src/objc/Apex.swift +6 -0
  25. data/ext/apex_ext/apex_src/objc/NSString+Apex.h +12 -0
  26. data/ext/apex_ext/apex_src/objc/NSString+Apex.m +9 -0
  27. data/ext/apex_ext/apex_src/pages/index.md +459 -0
  28. data/ext/apex_ext/apex_src/src/_README.md +4 -4
  29. data/ext/apex_ext/apex_src/src/apex.c +702 -44
  30. data/ext/apex_ext/apex_src/src/ast_json.c +1130 -0
  31. data/ext/apex_ext/apex_src/src/ast_json.h +46 -0
  32. data/ext/apex_ext/apex_src/src/ast_man.c +948 -0
  33. data/ext/apex_ext/apex_src/src/ast_markdown.c +409 -0
  34. data/ext/apex_ext/apex_src/src/ast_terminal.c +2516 -0
  35. data/ext/apex_ext/apex_src/src/extensions/abbreviations.c +8 -5
  36. data/ext/apex_ext/apex_src/src/extensions/definition_list.c +491 -1514
  37. data/ext/apex_ext/apex_src/src/extensions/definition_list.h +8 -15
  38. data/ext/apex_ext/apex_src/src/extensions/emoji.c +207 -0
  39. data/ext/apex_ext/apex_src/src/extensions/emoji.h +14 -0
  40. data/ext/apex_ext/apex_src/src/extensions/header_ids.c +178 -71
  41. data/ext/apex_ext/apex_src/src/extensions/highlight.c +37 -5
  42. data/ext/apex_ext/apex_src/src/extensions/ial.c +416 -47
  43. data/ext/apex_ext/apex_src/src/extensions/includes.c +241 -10
  44. data/ext/apex_ext/apex_src/src/extensions/includes.h +1 -0
  45. data/ext/apex_ext/apex_src/src/extensions/metadata.c +166 -3
  46. data/ext/apex_ext/apex_src/src/extensions/metadata.h +7 -0
  47. data/ext/apex_ext/apex_src/src/extensions/sup_sub.c +34 -3
  48. data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.c +55 -10
  49. data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.h +7 -4
  50. data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.c +84 -52
  51. data/ext/apex_ext/apex_src/src/extensions/toc.c +133 -19
  52. data/ext/apex_ext/apex_src/src/filters_ast.c +194 -0
  53. data/ext/apex_ext/apex_src/src/filters_ast.h +36 -0
  54. data/ext/apex_ext/apex_src/src/html_renderer.c +1265 -35
  55. data/ext/apex_ext/apex_src/src/html_renderer.h +21 -0
  56. data/ext/apex_ext/apex_src/src/plugins_remote.c +40 -14
  57. data/ext/apex_ext/apex_src/tests/CMakeLists.txt +1 -0
  58. data/ext/apex_ext/apex_src/tests/README.md +11 -5
  59. data/ext/apex_ext/apex_src/tests/fixtures/comprehensive_test.md +13 -2
  60. data/ext/apex_ext/apex_src/tests/fixtures/filters/filter_output_with_rawblock.json +1 -0
  61. data/ext/apex_ext/apex_src/tests/fixtures/filters/unwrap.md +7 -0
  62. data/ext/apex_ext/apex_src/tests/fixtures/images/auto-wildcard.md +8 -0
  63. data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu.avif +0 -0
  64. data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu.jpg +0 -0
  65. data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu.webp +0 -0
  66. data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu@2x.avif +0 -0
  67. data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu@2x.jpg +0 -0
  68. data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu@2x.webp +0 -0
  69. data/ext/apex_ext/apex_src/tests/fixtures/images/media_formats_test.md +63 -0
  70. data/ext/apex_ext/apex_src/tests/fixtures/includes/data-semi.csv +3 -0
  71. data/ext/apex_ext/apex_src/tests/fixtures/includes/with space.txt +1 -0
  72. data/ext/apex_ext/apex_src/tests/fixtures/tables/inline_tables_test.md +4 -1
  73. data/ext/apex_ext/apex_src/tests/paginate_cli_test.sh +64 -0
  74. data/ext/apex_ext/apex_src/tests/terminal_width_test.sh +29 -0
  75. data/ext/apex_ext/apex_src/tests/test-swift-package.sh +14 -0
  76. data/ext/apex_ext/apex_src/tests/test_cmark_callback.c +189 -0
  77. data/ext/apex_ext/apex_src/tests/test_extensions.c +374 -0
  78. data/ext/apex_ext/apex_src/tests/test_metadata.c +68 -0
  79. data/ext/apex_ext/apex_src/tests/test_output.c +291 -2
  80. data/ext/apex_ext/apex_src/tests/test_runner.c +10 -0
  81. data/ext/apex_ext/apex_src/tests/test_syntax_highlight.c +1 -1
  82. data/ext/apex_ext/apex_src/tests/test_tables.c +17 -1
  83. data/lib/apex/version.rb +1 -1
  84. metadata +32 -2
  85. data/ext/apex_ext/apex_src/docs/FUTURE_FEATURES.md +0 -456
@@ -41,33 +41,67 @@ compatibility.
41
41
 
42
42
  **-s**, **--standalone**
43
43
  : Generate complete HTML document with `<html>`, `<head>`,
44
- and `<body>` tags.
44
+ and `<body>` tags.
45
45
 
46
46
  **--style** *FILE*, **--css** *FILE*
47
47
  : Link to CSS file(s) in document head (requires
48
- **--standalone**). Can be used multiple times or accept
49
- comma-separated list (e.g., `--css style.css --css syntax.css`
50
- or `--css style.css,syntax.css`). Overrides CSS metadata if
51
- specified.
48
+ **--standalone**). Can be used multiple times or accept
49
+ comma-separated list (e.g., `--css style.css --css syntax.css`
50
+ or `--css style.css,syntax.css`). Overrides CSS metadata if
51
+ specified.
52
52
 
53
53
  **--embed-css**
54
54
  : When used with **--css FILE**, read the CSS file(s) and embed
55
- their contents into `<style>` tags in the document head instead
56
- of emitting `<link rel="stylesheet">` tags. All specified
57
- stylesheets are embedded.
55
+ their contents into `<style>` tags in the document head instead
56
+ of emitting `<link rel="stylesheet">` tags. All specified
57
+ stylesheets are embedded.
58
+
59
+ **--width** *N*
60
+ : When using **--to terminal** or **--to terminal256**, hard-wrap ANSI-colored
61
+ output at *N* visible columns. This is especially useful in file manager
62
+ preview panes (such as **lf** or **yazi**) where Apex cannot detect the pane
63
+ width automatically. ANSI escape sequences are preserved and are not counted
64
+ toward the column limit. If not specified, Apex does not add extra wrapping
65
+ and the terminal itself controls line wrapping.
66
+
67
+ **-p**, **--paginate**
68
+ : When using **--to terminal**, **--to cli**, or **--to terminal256**, send
69
+ the rendered terminal output through a pager instead of writing directly to
70
+ stdout. The pager command is chosen in this order:
71
+
72
+ - If `$APEX_PAGER` is set and non-empty, Apex uses its value as the pager.
73
+ - Otherwise, if `$PAGER` is set and non-empty, Apex uses that.
74
+ - Otherwise, Apex falls back to `less -R`.
75
+
76
+ Pagination is ignored when the output format is not a terminal format or when
77
+ `-o/--output` is used to write to a file. You can also enable pagination via
78
+ metadata or config by setting `paginate: true`.
58
79
 
59
80
  **--code-highlight** *TOOL*
60
81
  : Use external tool for syntax highlighting of code blocks.
61
- *TOOL* must be **pygments** (or **p**, **pyg**) or **skylighting**
62
- (or **s**, **sky**). Code blocks are sent to the external tool
63
- with their language specifier (if present) or with
64
- auto-detection enabled. The highlighted HTML output replaces the
65
- original code block in the document.
82
+ *TOOL* must be **pygments** (or **p**, **pyg**), **skylighting**
83
+ (or **s**, **sky**), or **shiki** (or **sh**). Code blocks are sent
84
+ to the external tool with their language specifier (if present) or
85
+ with auto-detection enabled. Output format is HTML or ANSI
86
+ depending on destination (e.g. **--to terminal**). Shiki requires
87
+ a language when it cannot auto-detect; on error, the block is
88
+ left as plain text.
89
+
90
+ **--code-highlight-theme** *THEME*
91
+ : Theme/style name for external syntax highlighters.
92
+ When using **pygments**, this maps to the Pygments style name in
93
+ both HTML and terminal output (e.g. `style=THEME`). When using
94
+ **skylighting**, it maps to the Skylighting style name via
95
+ `--style THEME` for both HTML and ANSI terminal output. When using
96
+ **shiki**, it maps to the Shiki theme via `--theme THEME` for
97
+ both HTML and terminal/ANSI output. See **--list-themes** for
98
+ available theme names for each tool.
66
99
 
67
100
  **--code-line-numbers**
68
101
  : Include line numbers in syntax-highlighted code blocks.
69
102
  Requires **--code-highlight**. When used with Pygments, adds
70
103
  `linenos=1` option. When used with Skylighting, adds `-n` flag.
104
+ Shiki does not support line numbers in CLI mode.
71
105
 
72
106
  **--highlight-language-only**
73
107
  : Only apply syntax highlighting to code blocks that have a language
@@ -103,6 +137,19 @@ output. When enabled, adds:
103
137
  This enhances screen reader support and makes the HTML
104
138
  output more accessible. Default: disabled.
105
139
 
140
+ **-t** *FORMAT*, **--to** *FORMAT*
141
+ : Output format. One of:
142
+
143
+ - **html** (default) - Rendered HTML
144
+ - **json**, **json-filtered**, **ast-json**, **ast** - JSON output (before or after filters)
145
+ - **markdown**, **md**, **mmd**, **commonmark**, **cmark**, **kramdown**, **gfm** - Markdown variants
146
+ - **terminal**, **cli**, **terminal256** - ANSI-colored output for TTYs and terminal emulators
147
+ - **man** - Man page roff source (.TH, .SH, etc.)
148
+ - **man-html** - Styled HTML man page (use **--standalone** for full page with nav sidebar)
149
+
150
+ When using a terminal format, Apex emits ANSI-colored output suitable for TTYs and
151
+ terminal emulators.
152
+
106
153
  ## Feature Flags
107
154
 
108
155
  **--accept**
@@ -113,16 +160,18 @@ output more accessible. Default: disabled.
113
160
 
114
161
  **--code-highlight** *TOOL*
115
162
  : Use external tool for syntax highlighting of code blocks.
116
- *TOOL* must be **pygments** (or abbreviations **p**, **pyg**) or
117
- **skylighting** (or abbreviations **s**, **sky**). Code blocks
118
- are sent to the external tool with their language specifier (if
119
- present) or with auto-detection enabled. The highlighted HTML
120
- output replaces the original code block in the document.
163
+ *TOOL* must be **pygments** (or **p**, **pyg**), **skylighting**
164
+ (or **s**, **sky**), or **shiki** (or **sh**). Code blocks are sent
165
+ to the external tool with their language specifier (if present) or
166
+ with auto-detection enabled. Output format is HTML or ANSI
167
+ depending on destination. Shiki falls back to plain text when
168
+ language cannot be determined.
121
169
 
122
170
  **--code-line-numbers**
123
171
  : Include line numbers in syntax-highlighted code blocks.
124
172
  Requires **--code-highlight**. When used with Pygments, adds
125
173
  `linenos=1` option. When used with Skylighting, adds `-n` flag.
174
+ Shiki does not support line numbers in CLI mode.
126
175
 
127
176
  **--highlight-language-only**
128
177
  : Only apply syntax highlighting to code blocks that have a language
@@ -130,11 +179,10 @@ specified (via ` ```language ` or IAL). Code blocks without a language
130
179
  will be left unhighlighted. Requires **--code-highlight**.
131
180
 
132
181
  **--includes**, **--no-includes**
133
- : Enable or disable file inclusion. Enabled by default in
134
- unified mode.
182
+ : Enable or disable file inclusion. Enabled by default in unified mode.
135
183
 
136
184
  **--transforms**, **--no-transforms**
137
- :: Enable or disable metadata variable transforms
185
+ : Enable or disable metadata variable transforms
138
186
  (`[%key:transform]`). When enabled, metadata values can be
139
187
  transformed (case conversion, string manipulation, regex
140
188
  replacement, date formatting, etc.) when inserted into the
@@ -231,35 +279,35 @@ first item).
231
279
 
232
280
  **--per-cell-alignment**, **--no-per-cell-alignment**
233
281
  : Enable per-cell alignment markers in tables. When enabled, cells
234
- starting with a colon (`:`) are left-aligned, ending with a colon
235
- (`:`) are right-aligned, or both (`:content:`) are center-aligned.
236
- The colons are stripped from the output and replaced with
237
- `style="text-align: ..."` attributes. Default: enabled in unified
238
- mode, disabled in commonmark, gfm, mmd, and kramdown modes.
282
+ starting with a colon (`:`) are left-aligned, ending with a colon
283
+ (`:`) are right-aligned, or both (`:content:`) are center-aligned.
284
+ The colons are stripped from the output and replaced with
285
+ `style="text-align: ..."` attributes. Default: enabled in unified
286
+ mode, disabled in commonmark, gfm, mmd, and kramdown modes.
239
287
 
240
288
  **--captions** *POSITION*
241
289
  : Table caption position: **above** or **below** (default:
242
- **below**). Controls where table captions appear relative to
243
- the table.
290
+ **below**). Controls where table captions appear relative to
291
+ the table.
244
292
 
245
293
  ## HTML and Links
246
294
 
247
295
  **--unsafe**, **--no-unsafe**
248
296
  : Allow raw HTML in output. Default: true for
249
- unified/mmd/kramdown modes, false for commonmark/gfm modes.
297
+ unified/mmd/kramdown modes, false for commonmark/gfm modes.
250
298
 
251
299
  **--autolink**, **--no-autolink**
252
300
  : Enable autolinking of URLs and email addresses. Default:
253
- enabled in GFM, MultiMarkdown, Kramdown, and unified modes;
254
- disabled in CommonMark mode.
301
+ enabled in GFM, MultiMarkdown, Kramdown, and unified modes;
302
+ disabled in CommonMark mode.
255
303
 
256
304
  **--obfuscate-emails**
257
305
  : Obfuscate email links and text using HTML entities
258
- (hex-encoded).
306
+ (hex-encoded).
259
307
 
260
308
  **--wikilink-space** *MODE*
261
- :: Control how spaces in wiki link page names are handled in
262
- the generated URL. **MODE** must be one of:
309
+ : Control how spaces in wiki link page names are handled in
310
+ the generated URL. **MODE** must be one of:
263
311
 
264
312
  `dash` - Convert spaces to dashes: `[[Home Page]]` → `href="Home-Page"`
265
313
 
@@ -272,7 +320,10 @@ the generated URL. **MODE** must be one of:
272
320
  Default: `dash`.
273
321
 
274
322
  **--wikilink-extension** *EXT*
275
- :: Add a file extension to wiki link URLs. The extension is automatically prefixed with a dot if not provided. For example, `--wikilink-extension html` creates `href="Page.html"` and `--wikilink-extension .html` also creates `href="Page.html"`.
323
+ : Add a file extension to wiki link URLs. The extension is automatically
324
+ prefixed with a dot if not provided. For example, `--wikilink-extension html`
325
+ creates `href="Page.html"` and `--wikilink-extension .html` also creates
326
+ `href="Page.html"`.
276
327
 
277
328
  **--wikilink-sanitize**, **--no-wikilink-sanitize**
278
329
  : Sanitize wiki link URLs for cleaner, more compatible links. When enabled:
@@ -331,7 +382,7 @@ relative paths.
331
382
  : Enable or disable GFM-style strikethrough processing (`~~text~~`). When enabled, `~~text~~` renders as `<del>text</del>`. Default: enabled in GFM and unified modes; disabled in commonmark, mmd, and kramdown modes.
332
383
 
333
384
  **--divs**, **--no-divs**
334
- : Enable or disable Pandoc fenced divs syntax (`::::: {#id .class} ... :::::`). Fenced divs allow you to create HTML block elements with attributes using a special fence syntax. By default, fenced divs create `<div>` elements, but you can specify different block types using the `>blocktype` syntax (e.g., `::: >aside {.sidebar} ... :::` creates an `<aside>` element instead). Opening fences must have at least 3 colons and attributes; closing fences need at least 3 colons. Fenced divs can be nested, including different block types. Default: enabled in unified mode only.
385
+ : Enable or disable Pandoc fenced divs syntax (`:::: {#id .class} ... :::::`). Fenced divs allow you to create HTML block elements with attributes using a special fence syntax. By default, fenced divs create `<div>` elements, but you can specify different block types using the `>blocktype` syntax (e.g., `:: >aside {.sidebar} ... :::` creates an `<aside>` element instead). Opening fences must have at least 3 colons and attributes; closing fences need at least 3 colons. Fenced divs can be nested, including different block types. Default: enabled in unified mode only.
335
386
 
336
387
  **--spans**, **--no-spans**
337
388
  : Enable or disable Pandoc-style bracketed spans syntax (`[text]{#id .class key="val"}`). Bracketed spans allow you to create HTML `<span>` elements with attributes. The text inside the brackets is processed as markdown. If the bracketed text matches a reference link definition, it will be treated as a link instead of a span. Default: enabled in unified mode only.
@@ -379,22 +430,20 @@ found.
379
430
 
380
431
  **--indices**
381
432
  : Enable index processing. Supports both mmark and TextIndex
382
- syntax. Default: enabled in MultiMarkdown and unified modes.
433
+ syntax. Default: enabled in MultiMarkdown and unified modes.
383
434
 
384
435
  **--no-indices**
385
436
  : Disable index processing.
386
437
 
387
438
  **--no-index**
388
439
  : Suppress index generation at the end of the document.
389
- Index markers are still created in the document, but the
390
- index section is not generated.
440
+ Index markers are still created in the document, but the
441
+ index section is not generated.
391
442
 
392
443
  Index syntax is supported in MultiMarkdown and unified
393
444
  modes:
394
445
 
395
- - **mmark syntax**: `(!item)`, `(!item, subitem)`, `(!!item,
396
-
397
- subitem)` for primary entries
446
+ - **mmark syntax**: `(!item)`, `(!item, subitem)`, `(!!item, subitem)` for primary entries
398
447
 
399
448
  - **TextIndex syntax**: `word{^}`, `[term]{^}`, `{^params}`
400
449
 
@@ -403,25 +452,62 @@ document or at the `<!--INDEX-->` marker if present. Entries
403
452
  are sorted alphabetically and can be grouped by first
404
453
  letter.
405
454
 
455
+ ## AST Filters
456
+
457
+ **--filter** *NAME*
458
+ : Run a single AST filter from the user filters directory
459
+ (`$XDG_CONFIG_HOME/apex/filters` or `~/.config/apex/filters`). *NAME* is
460
+ the basename of an executable that reads Pandoc JSON from stdin and writes
461
+ Pandoc JSON to stdout.
462
+
463
+ **--filters**
464
+ : Run all executable files in the user filters directory, in sorted
465
+ filename order. Directory filters run first if **--filter** is also used.
466
+
467
+ **--lua-filter** *FILE*
468
+ : Run a Lua script as an AST filter. Apex invokes the system **lua**
469
+ interpreter with *FILE*. The script reads a Pandoc JSON document from
470
+ stdin and must write a Pandoc JSON document to stdout. A JSON library
471
+ (e.g. dkjson) is required; see the Filters documentation for details.
472
+
473
+ **--no-strict-filters**
474
+ : Do not abort when a filter fails or returns invalid JSON; log a
475
+ warning and continue with the previous AST. Default: abort on error.
476
+
477
+ **--list-filters**
478
+ : List installed filters and available filters from the central
479
+ apex-filters directory. Shows filter IDs; available filters show
480
+ title, author, description, and homepage.
481
+
482
+ **--install-filter** *ID-or-URL*
483
+ : Install an AST filter into the user filters directory. *ID-or-URL*
484
+ may be a filter ID from the central apex-filters directory (e.g.
485
+ **unwrap**) or a Git URL / GitHub shorthand. When installing from a URL,
486
+ Apex may prompt for confirmation.
487
+
488
+ **--uninstall-filter** *ID*
489
+ : Uninstall a filter by ID. Removes the filter (file or directory)
490
+ from the user filters directory. Apex prompts for confirmation.
491
+
406
492
  ## Plugins
407
493
 
408
494
  **--plugins**, **--no-plugins**
409
495
  : Enable or disable external/plugin processing. Plugins
410
- extend Apex with custom processing capabilities.
496
+ extend Apex with custom processing capabilities.
411
497
 
412
498
  **--list-plugins**
413
499
  : List installed plugins and available plugins from the
414
- remote directory. Shows both locally installed plugins and
415
- plugins available for installation from the Apex plugin
416
- directory.
500
+ remote directory. Shows both locally installed plugins and
501
+ plugins available for installation from the Apex plugin
502
+ directory.
417
503
 
418
504
  **--install-plugin** *ID*
419
505
  : Install a plugin by ID from the remote directory, or by Git URL/GitHub shorthand (user/repo). Plugins are installed to `$XDG_CONFIG_HOME/apex/plugins` (or `~/.config/apex/plugins` when `XDG_CONFIG_HOME` is not set). When installing from a URL or GitHub shorthand, Apex will prompt for confirmation since plugins execute unverified code.
420
506
 
421
507
  **--uninstall-plugin** *ID*
422
508
  : Uninstall a plugin by ID. Removes the plugin directory
423
- from the plugins folder. Apex will prompt for confirmation
424
- before removing the plugin.
509
+ from the plugins folder. Apex will prompt for confirmation
510
+ before removing the plugin.
425
511
 
426
512
  ## General Options
427
513
 
@@ -438,16 +524,15 @@ before removing the plugin.
438
524
 
439
525
  **--combine** *files...*
440
526
  : Concatenate one or more Markdown files into a single
441
- Markdown stream, expanding all supported include syntaxes.
442
- When a `SUMMARY.md` file is provided, Apex treats it as a
443
- GitBook-style index and combines the linked files in order.
444
- Output is raw Markdown suitable for piping back into Apex.
527
+ Markdown stream, expanding all supported include syntaxes.
528
+ When a `SUMMARY.md` file is provided, Apex treats it as a
529
+ GitBook-style index and combines the linked files in order.
530
+ Output is raw Markdown suitable for piping back into Apex.
445
531
 
446
532
  **--mmd-merge** *index files...*
447
- : Merge files from one or more MultiMarkdown `mmd_merge`-style index files into a single Markdown stream. Each non-empty, non-comment line in an index file specifies a document to include. Lines whose first non-whitespace character is `#` are treated as comments and ignored. Indentation (tabs or groups of four spaces) before the filename increases the header level of the included document (each indent level shifts all Markdown headings in that file down one level). Output is raw Markdown suitable for piping into Apex, for example:
533
+ : Merge files from one or more MultiMarkdown `mmd_merge`-style index files into a single Markdown stream. Each non-empty, non-comment line in an index file specifies a document to include. Lines whose first non-whitespace character is `#` are treated as comments and ignored. Indentation (tabs or groups of four spaces) before the filename increases the header level of the included document (each indent level shifts all Markdown headings in that file down one level). Output is raw Markdown suitable for piping into Apex, for example:
448
534
 
449
- apex --mmd-merge index.txt | apex --mode mmd --standalone -o
450
- book.html
535
+ apex --mmd-merge index.txt | apex --mode mmd --standalone -o book.html
451
536
 
452
537
  # EXAMPLES
453
538
 
@@ -493,20 +578,20 @@ Process from stdin:
493
578
 
494
579
  **commonmark**
495
580
  : Pure CommonMark specification. Minimal features, maximum
496
- compatibility.
581
+ compatibility.
497
582
 
498
583
  **gfm**
499
584
  : GitHub Flavored Markdown. Includes tables, strikethrough,
500
- task lists, autolinks, and more.
585
+ task lists, autolinks, and more.
501
586
 
502
587
  **mmd**, **multimarkdown**
503
588
  : MultiMarkdown compatibility. Includes metadata, definition
504
- lists, footnotes, and more.
589
+ lists, footnotes, and more.
505
590
 
506
591
  **kramdown**
507
592
  : Kramdown compatibility. Includes relaxed tables, IAL
508
- (Inline Attribute Lists) for adding HTML attributes to
509
- elements, and more.
593
+ (Inline Attribute Lists) for adding HTML attributes to
594
+ elements, and more.
510
595
 
511
596
  **unified** (default)
512
597
  : All features enabled. Combines features from all modes.
@@ -567,59 +652,44 @@ Apex supports a wide range of Markdown extensions:
567
652
  - **Strikethrough**: GFM-style `~~text~~` (controlled by **--strikethrough**)
568
653
  - **Footnotes**: Reference-style footnotes
569
654
  - **Math**: Inline (`$...$`) and display (`$$...$$`) math
570
-
571
655
  with LaTeX
572
-
573
656
  - **Wiki Links**: `[[Page]]`, `[[Page|Display]]`,
574
-
575
657
  `[[Page#Section]]`
576
-
577
658
  - **Critic Markup**: All 5 types ({++add++}, {--del--},
578
-
579
659
  {~~sub~~}, {==mark==}, {>>comment<<})
580
-
581
660
  - **Smart Typography**: Smart quotes, dashes, ellipsis
582
661
  - **Definition Lists**: MultiMarkdown-style definition lists
583
662
  - **Task Lists**: GFM-style task lists
584
663
  - **Metadata**: YAML front matter, MultiMarkdown metadata,
585
-
586
664
  Pandoc title blocks
587
-
588
665
  - **Metadata Transforms**: Transform metadata values with
589
-
590
666
  `[%key:transform]` syntax (case conversion, string
591
667
  manipulation, regex replacement, date formatting, etc.)
592
-
593
668
  - **Metadata Control of Options**: Control command-line
594
-
595
669
  options via metadata for per-document configuration
596
-
597
670
  - **Header IDs**: Automatic or manual header IDs with
598
-
599
671
  multiple format options
600
-
601
672
  - **Relaxed Tables**: Support for tables without separator
602
- rows (Kramdown-style). Enabled by default in unified and
603
- Kramdown modes.
604
-
673
+ rows (Kramdown-style). Enabled by default in unified and
674
+ Kramdown modes.
605
675
  - **Per-Cell Alignment**: Support for alignment markers using
606
- colons at the start and/or end of table cells. Enabled by default
607
- in unified mode only.
608
-
609
- rows (Kramdown-style)
610
-
676
+ colons at the start and/or end of table cells. Enabled by default
677
+ in unified mode only.
611
678
  - **Inline Tables from CSV/TSV**: Convert inline CSV/TSV
612
-
613
679
  text to tables using ```table fences or `<!--TABLE-->`
614
680
  markers
681
+ - **Superscript/Subscript**: MultiMarkdown-style superscript (`^text`) and
682
+ subscript (`~text~` within words) syntax. Subscript uses paired tildes within
683
+ word boundaries (e.g., `H~2~O`), while tildes at word boundaries create
684
+ underline
685
+ - **Image Embedding**: Embed local images as base64 data URLs with `--embed-images` flag
686
+ - **Inline Attribute Lists (IAL)**: Kramdown-style syntax for adding HTML
687
+ attributes (IDs, classes, key-value pairs) to block-level and inline elements.
688
+ Supports Attribute List Definitions (ALDs) for reusable attribute sets. Available in
689
+ kramdown and unified modes. See
690
+ [Inline Attribute Lists](https://github.com/ttscoff/apex/wiki/Inline-Attribute-Lists)
691
+ for complete documentation
615
692
 
616
- **Superscript/Subscript**: MultiMarkdown-style superscript (`^text`) and subscript (`~text~` within words) syntax. Subscript uses paired tildes within word boundaries (e.g., `H~2~O`), while tildes at word boundaries create underline
617
-
618
- - **Image Embedding**: Embed local images as base64 data
619
-
620
- URLs with `--embed-images` flag
621
-
622
- **Inline Attribute Lists (IAL)**: Kramdown-style syntax for adding HTML attributes (IDs, classes, key-value pairs) to block-level and inline elements. Supports Attribute List Definitions (ALDs) for reusable attribute sets. Available in kramdown and unified modes. See [Inline Attribute Lists](https://github.com/ttscoff/apex/wiki/Inline-Attribute-Lists) for complete documentation
623
693
 
624
694
  # SEE ALSO
625
695
 
@@ -6,6 +6,7 @@
6
6
 
7
7
  import Foundation
8
8
  @_exported import ApexObjC
9
+ @_exported import ApexC
9
10
 
10
11
  /// Apex processor mode
11
12
  /// Type-safe enum for processor modes
@@ -177,6 +178,11 @@ extension String {
177
178
  /// Static Apex converter
178
179
  /// Provides static methods for conversion
179
180
  public struct Apex {
181
+ /// Apex processor version string (e.g. "0.1.89")
182
+ public static var version: String {
183
+ return NSString.apexVersion() as String
184
+ }
185
+
180
186
  /**
181
187
  * Convert Markdown to HTML using Apex in unified mode
182
188
  */
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  #import <Foundation/Foundation.h>
7
+ #import <apex/apex.h>
7
8
 
8
9
  NS_ASSUME_NONNULL_BEGIN
9
10
 
@@ -18,6 +19,17 @@ extern NSString * const ApexModeUnified;
18
19
 
19
20
  @interface NSString (Apex)
20
21
 
22
+ /**
23
+ * Return Apex default C options structure.
24
+ * Exposed for Swift/plugin integrations that need low-level option flags.
25
+ */
26
+ + (apex_options)defaultApexOptions;
27
+
28
+ /**
29
+ * Apex processor version string (e.g. "0.1.89")
30
+ */
31
+ + (NSString *)apexVersion;
32
+
21
33
  /**
22
34
  * Convert Markdown to HTML using Apex processor in unified mode
23
35
  * @param inputString The markdown text to convert
@@ -17,6 +17,15 @@ NSString *const ApexModeUnified = @"unified";
17
17
 
18
18
  @implementation NSString (Apex)
19
19
 
20
+ + (apex_options)defaultApexOptions {
21
+ return apex_options_default();
22
+ }
23
+
24
+ + (NSString *)apexVersion {
25
+ const char *ver = apex_version_string();
26
+ return ver ? [NSString stringWithUTF8String:ver] : @"";
27
+ }
28
+
20
29
  /**
21
30
  * Convert mode string to apex_mode_t enum
22
31
  */