apex-ruby 1.0.6 → 1.0.8

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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 246b73a353cd5ad9f40ddf21474502ddf7b7b35e094c1c4ce5010c3615ae2536
4
- data.tar.gz: 82f2120a839c164d26c258ff2b7f034bc26ddf4bfa93e61d248cb893219a30c2
3
+ metadata.gz: 2d9d2cda95e5896112f209b03223dc28a0188734c076bb06faf207444e1c42c4
4
+ data.tar.gz: e459f864e424a5de55c730e160083afa070a9287ed9f002c40aa97ca2fe1444c
5
5
  SHA512:
6
- metadata.gz: cf4368bc5090e6dbefae29f5c6d8af8981af1272b477805f8bb3ba56dbef4bf8fe80df4555ababe4c1eae1bdb554f7341b5f3ab89f631eb292f973630b3d2760
7
- data.tar.gz: 5ef47aa92805e6d98f3928c8c309eb4128db716227241c3363fa16130b42b8e52edea7d167bc0dc0226f795015a5389b2fc68a1a922e2a10194ce24dc79c8952
6
+ metadata.gz: 04e7e651d63995560ee4bbbf720f6c399aad0baeda0fa0c44df81e339188c870b2f8ee0101a1edf72c9a1352c2fa206bf170f0827735798e9be599b0f72b8cd9
7
+ data.tar.gz: 32ebb59fdde780bbb681923ad333392157e7aea7eb6636e20227fc409086abb8d38537e82b068937a5807878ae7acb8591265fb34a2cb1444b43bae82710402a
@@ -110,6 +110,8 @@ options_from_hash(VALUE h)
110
110
  set_bool(h, "github_pre_lang", &o.github_pre_lang);
111
111
  set_bool(h, "standalone", &o.standalone);
112
112
  set_bool(h, "pretty", &o.pretty);
113
+ set_bool(h, "xhtml", &o.xhtml);
114
+ set_bool(h, "strict_xhtml", &o.strict_xhtml);
113
115
  set_cstr(h, "document_title", &o.document_title);
114
116
 
115
117
  /* Line break handling */
@@ -155,6 +157,10 @@ options_from_hash(VALUE h)
155
157
  /* Emoji options */
156
158
  set_bool(h, "enable_emoji_autocorrect", &o.enable_emoji_autocorrect);
157
159
 
160
+ /* Terminal output (optional; defaults come from apex_options_default) */
161
+ set_bool(h, "terminal_inline_images", &o.terminal_inline_images);
162
+ set_int (h, "terminal_image_width", &o.terminal_image_width);
163
+
158
164
  /* Syntax highlighting options */
159
165
  set_cstr(h, "code_highlighter", &o.code_highlighter);
160
166
  set_bool(h, "code_line_numbers", &o.code_line_numbers);
@@ -0,0 +1,41 @@
1
+ # Agent Instructions
2
+
3
+ This project uses **bd** (beads) for issue tracking. Run `bd onboard` to get started.
4
+
5
+ ## Quick Reference
6
+
7
+ ```bash
8
+ bd ready # Find available work
9
+ bd show <id> # View issue details
10
+ bd update <id> --status in_progress # Claim work
11
+ bd close <id> # Complete work
12
+ bd sync # Sync with git
13
+ ```
14
+
15
+ ## Landing the Plane (Session Completion)
16
+
17
+ **When ending a work session**, you MUST complete ALL steps below. Work is NOT complete until `git push` succeeds.
18
+
19
+ **MANDATORY WORKFLOW:**
20
+
21
+ 1. **File issues for remaining work** - Create issues for anything that needs follow-up
22
+ 2. **Run quality gates** (if code changed) - Tests, linters, builds
23
+ 3. **Update issue status** - Close finished work, update in-progress items
24
+ 4. **PUSH TO REMOTE** - This is MANDATORY:
25
+ ```bash
26
+ git pull --rebase
27
+ bd sync
28
+ git push
29
+ git status # MUST show "up to date with origin"
30
+ ```
31
+ 5. **Clean up** - Clear stashes, prune remote branches
32
+ 6. **Verify** - All changes committed AND pushed
33
+ 7. **Hand off** - Provide context for next session
34
+
35
+ **CRITICAL RULES:**
36
+ - Work is NOT complete until `git push` succeeds
37
+ - NEVER stop before pushing - that leaves work stranded locally
38
+ - NEVER say "ready to push when you are" - YOU must push
39
+ - If push fails, resolve and retry until it succeeds
40
+
41
+ Use 'bd' for task tracking
@@ -2,6 +2,393 @@
2
2
 
3
3
  All notable changes to Apex will be documented in this file.
4
4
 
5
+ ## [0.1.98] - 2026-03-19
6
+
7
+ ### Changed
8
+
9
+ - Homebrew formula bumped to 0.1.97.
10
+
11
+ ### Improved
12
+
13
+ - SwiftPM now exports the raw C API via the `ApexC` product.
14
+
15
+ ### Fixed
16
+
17
+ - Avoid Swift module-name collisions so `apex_*` symbols are visible from Swift.
18
+
19
+ ## [0.1.97] - 2026-03-19
20
+
21
+ ### Changed
22
+
23
+ - Metadata extraction is now mode-aware so Combined/Unified and Kramdown keep YAML-first interpretation of delimiter blocks, while MMD uses MMD-compatible precedence.
24
+
25
+ ### New
26
+
27
+ - CSV and TSV includes now support custom separators via {delimiter=X} and single-character shorthand {X} while keeping comma/tab defaults when no override is provided.
28
+ - This release adds delimiter support as discussed in [#13](https://github.com/ApexMarkdown/apex/issues/13)
29
+
30
+ ### Improved
31
+
32
+ - Metadata-to-meta conversion now works consistently in MultiMarkdown, Unified (combined), and Kramdown modes.
33
+ - In --mode mmd, delimiter-style metadata is parsed using MultiMarkdown rules while still falling back to YAML parsing for true YAML front matter.
34
+ - Include parsing now recognizes explicit delimiter overrides consistently across iA Writer, Marked, and MultiMarkdown include styles for CSV/TSV table conversion.
35
+
36
+ ### Fixed
37
+
38
+ - Standalone HTML now emits generic metadata headers as <meta name="..."> tags instead of dropping them.
39
+ - Generated meta tags preserve declared metadata order and safely escape attribute content.
40
+ - MultiMarkdown mode now accepts delimited metadata blocks with dash or dot closers (for example "----" ... "......") without leaking the delimiter into HTML output.
41
+ - Marked include syntax now supports embedded delimiter overrides inside the include token (for example <<[data.csv{;}] and <<[data.csv{delimiter=;}] ) to avoid conflicts with bracket-plus-brace parsing patterns.
42
+ - MultiMarkdown transclusions now accept embedded delimiter overrides (for example {{data.csv{;}}} and {{data.csv{delimiter=;}}}) and no longer fail when braces appear inside the transclusion path.
43
+ - This release resolves [#17](https://github.com/ApexMarkdown/apex/issues/17)
44
+
45
+ ## [0.1.96] - 2026-03-19
46
+
47
+ ### Improved
48
+
49
+ - Swift plugin integrations can now fetch default low-level options through NSString.defaultApexOptions() and mutate apex_options fields directly.
50
+
51
+ ### Fixed
52
+
53
+ - Swift-side module visibility for C interop is improved by exporting ApexC from the Apex Swift module.
54
+
55
+ ## [0.1.95] - 2026-03-16
56
+
57
+ ### Improved
58
+
59
+ - Added all_checks target that runs C tests and Swift package builds together for one-command verification before publishing
60
+ - Cleanup: quieter tests by fixing logical-op and unused-variable warnings in table test suite
61
+
62
+ ### Fixed
63
+
64
+ - Swift package now compiles cleanly in debug and release as part of all_checks, catching Swift-side breakage before release
65
+ - Man-page renderer builds without enum or options-type warnings in both CMake CLI and Swift package builds
66
+
67
+ ## [0.1.94] - 2026-03-07
68
+
69
+ ### Fixed
70
+
71
+ - CMake/C99 build: add missing stdlib.h so malloc, free, realloc, getenv, and strtol are declared (fixes build on strict compilers)
72
+ - Bracketed spans like [-]{.taskmarker} no longer trigger list parsing; markdown="span" is only emitted when the span content contains inline markdown syntax (emphasis, links, code, etc.)
73
+
74
+ ## [0.1.93] - 2026-03-05
75
+
76
+ ### New
77
+
78
+ - Tests that one-line definition list syntax (term::definition) is not converted inside inline code spans, fenced code blocks, indented code blocks, and multi-line inline code
79
+ - Tests that emoji (:name:) patterns are not converted inside inline code spans, fenced code blocks, and indented code blocks
80
+
81
+ ### Improved
82
+
83
+ - HTML emoji replacement skips content inside <code> and <pre> elements so code examples display :emoji: patterns as written
84
+
85
+ ### Fixed
86
+
87
+ - Definition list one-line term::definition no longer converts inside inline code spans (backticks), preserving literal syntax in code examples
88
+ - Definition list processing now skips indented code blocks (4+ spaces or tab), not just fenced blocks
89
+ - Kramdown-style : definition lines inside multi-line inline code spans are no longer incorrectly parsed as definition list items
90
+ - Emoji replacement (:name:) is now skipped inside fenced code blocks, indented code blocks, and inline code spans so patterns remain literal
91
+ - Emoji autocorrect no longer modifies :emoji: patterns inside any code context
92
+
93
+ ## [0.1.92] - 2026-03-05
94
+
95
+ ### Changed
96
+
97
+ - Update apex_options cmark_init/cmark_done callback signatures to add a user_data parameter, requiring existing C/Obj-C callback implementations to add a fourth void* argument when upgrading
98
+
99
+ ### Improved
100
+
101
+ - Ensure custom cmark-gfm init/done callbacks configured via apex_options work consistently so extension-based integrations remain stable across builds
102
+ - Better integration of Apex as library
103
+
104
+ ### Fixed
105
+
106
+ - Fix cmark_done callback invocation to match the 3-argument apex_options callback signature so builds succeed again
107
+ - Update test cmark callback helper signatures and option fields to use the current cmark_init/cmark_done API and keep the test runner passing
108
+ - Fix cmark_done callback invocation to match the 4-argument apex_options callback signature including user_data so builds succeed again
109
+ - Add new tests and fix missing includes
110
+
111
+ ## [0.1.91] - 2026-03-04
112
+
113
+ ### New
114
+
115
+ - Add test fixtures for percent decoding
116
+
117
+ ### Improved
118
+
119
+ - Apex_extract_heading_text now recurses into inline containers (EMPH, STRONG, LINK) and includes HTML_INLINE literal content so extracted text matches rendered HTML for reliable (level, text) matching during ID injection
120
+
121
+ ### Fixed
122
+
123
+ - Headings with inline emphasis (e.g. "### *Processing* modes") now receive IDs correctly instead of being skipped
124
+ - Headings with ampersands (e.g. "## Documentation & resources") now receive IDs correctly by extracting text from HTML_INLINE nodes
125
+
126
+ ## [0.1.90] - 2026-03-04
127
+
128
+ ### New
129
+
130
+ - Apex_options.cmark_init callback: register custom cmark-gfm syntax extensions before parsing; call cmark_parser_attach_syntax_extension() in your callback (include cmark-gfm.h and cmark-gfm-extension_api.h when implementing) Resolves [#10](https://github.com/ApexMarkdown/apex/issues/10)
131
+ - Apex_version_string() exposed in ObjC/Swift via [NSString apexVersion] and Apex.version
132
+
133
+ ### Improved
134
+
135
+ - CSV/TSV inline tables (```table fences, <!--TABLE-->, includes) now accept Markdown-style alignment specs in the second row. Cells containing only colons and dashes (e.g. :--, --:, :--:) are parsed by colon position: leading = left, trailing = right, both = center, neither = auto. Keywords (left, right, center, auto) continue to work unchanged. Resolves [#14](https://github.com/ApexMarkdown/apex/issues/14)
136
+
137
+ ### Fixed
138
+
139
+ - Include paths now support percent encoding (e.g. <<[with%20space.txt], {{file%20name}}, /path%20to%2Ffile) so paths with spaces and special characters resolve correctly to files on disk. Resolves [#12](https://github.com/ApexMarkdown/apex/issues/12)
140
+
141
+ ## [0.1.89] - 2026-03-04
142
+
143
+ ### Improved
144
+
145
+ - CSV/TSV inline tables: alignment row may use Markdown-style syntax (`:--`, `--:`, `:--:`) in addition to keywords (left, right, center, auto). Cells containing only colons and dashes are parsed by colon position: leading colon = left, trailing = right, both = center, neither = auto.
146
+
147
+ ### Changed
148
+
149
+ - Definition lists rewritten as preprocessing (no cmark extension): supports Kramdown "term" + ": definition" or ":: definition", plus one-line "term::definition" and "term :: definition" using last :: to avoid splitting URLs
150
+ - CLI flags --one-line-definitions and --no-one-line-definitions to enable or disable definition list processing
151
+ - Metadata keys one-line-definitions and one_line_definitions for front-matter control of definition lists
152
+ - Table caption ": Caption" no longer misparses Kramdown definition lines (e.g. "Term\n\n: definition 1") by requiring prev_line_was_table_row or in_table_section instead of prev_line_was_blank alone
153
+ - Table captions before tables: ": Caption" now recognized when the next non-blank line is a table row
154
+ - Table caption paragraphs removed from output so captions appear only in figcaption, not duplicated as standalone paragraphs
155
+
156
+ ## [0.1.88] - 2026-03-02
157
+
158
+ ### Changed
159
+
160
+ - Formula/apex.rb: version 0.1.87, update macOS universal tarball sha256
161
+
162
+ ### Improved
163
+
164
+ - Definition lists: support indented continuation lines (4+ spaces) so multi-line definitions stay within a single dd element instead of splitting into separate paragraphs
165
+
166
+ ### Fixed
167
+
168
+ - Disable smart typography for man and man-html output so option names like --to and --standalone render as literal double hyphen instead of en-dash
169
+ - Prevent metadata from overwriting -t man-html when document sets mode or other options in front matter
170
+ - Force disable smart typography for man and man-html output in apex_markdown_to_html so option names stay as literal --
171
+ - Man-html: Replace UTF-8 en-dash (U+2013) with "--" in rendered text and definition list HTML blocks so options like --standalone display correctly even when smart typography slips through
172
+
173
+ ## [0.1.87] - 2026-03-02
174
+
175
+ ### Changed
176
+
177
+ - Formula/apex.rb: version 0.1.86, update macOS universal tarball sha256
178
+
179
+ ### Fixed
180
+
181
+ - Linux release build: add missing limits.h include for INT_MAX in apex_cli_terminal_width
182
+
183
+ ## [0.1.86] - 2026-03-02
184
+
185
+ ### Changed
186
+
187
+ - Syntax highlighter chooses HTML or ANSI output based on destination format (--format html vs --format ansi for Shiki when output is terminal).
188
+ - Apex_apply_syntax_highlighting() now takes a fifth parameter ansi_output (bool); pass false for HTML output, true for terminal/ANSI. All internal call sites updated; direct callers (e.g. Swift/SPM) must be updated.
189
+ - Pygments highlighting now respects code-highlight-theme for both HTML and terminal/terminal256 output (maps to style=THEME).
190
+ - Skylighting highlighting now respects code-highlight-theme for both HTML and ANSI terminal output (maps to --style THEME) and chooses --color-level=16/256 based on terminal vs terminal256.
191
+ - Shiki highlighting now uses --theme THEME for both HTML and ANSI output and chooses --format html/ansi based on destination format.
192
+
193
+ ### New
194
+
195
+ - Support --code-highlight shiki (and abbreviation sh) on the command line; uses the shiki CLI (@shikijs/cli) when available.
196
+ - Support code-highlight: shiki and code-highlight: sh in metadata and config (front matter, meta-file, config.yml).
197
+ - Add --list-themes CLI command to print available Pygments and Skylighting themes in columns and point to bundled Shiki themes.
198
+ - Add -p/--paginate flag to page terminal/cli/terminal256 output through a user-configurable pager instead of writing directly to stdout.
199
+ - Add paginate: true config option (and terminal.paginate) to enable pagination by default for terminal-style output while still allowing per-run overrides.
200
+
201
+ ### Improved
202
+
203
+ - When Shiki exits with an error (e.g. language not specified and cannot be auto-detected), the code block is left as plain text instead of failing.
204
+
205
+ ### Fixed
206
+
207
+ - Prevent segfault when external code highlighting is enabled without an explicit theme by initializing the code highlight theme option safely in the default configuration.
208
+
209
+ ## [0.1.85] - 2026-03-01
210
+
211
+ ### Changed
212
+
213
+ - Makefile "make man" now generates man pages with the built apex binary (apex -t man) after running "make build"; pandoc and go-md2man are no longer required.
214
+ - When both a TOC marker in code and a TOC marker in normal flow exist, only the first marker that is not inside <code> or <pre> is replaced with the generated table of contents.
215
+
216
+ ### New
217
+
218
+ - Definition list terms may use Kramdown-style double colon :: as well as single : before the definition (e.g. "term:: definition").
219
+ - Man page creation
220
+ - Man-html without -s/--standalone outputs content snippet only (no wrapper, no nav); with -s outputs full document with sidebar and headline.
221
+ - Man-html standalone: fixed left sidebar nav (TOC) for top-level sections only (NAME, SYNOPSIS, etc.), large headline from NAME section (command and description), document_title metadata used when present (e.g. APEX(1)).
222
+ - Man-html standalone: custom CSS via --css/--style emitted as <link rel="stylesheet"> after embedded style; optional syntax highlighting via --code-highlight (pygmentize/skylighting) for code blocks in both snippet and standalone output.
223
+
224
+ ### Improved
225
+
226
+ - CMake man page generation uses only apex_cli -t man when pre-generated pages are missing; removed duplicate/broken pandoc branch from merge and fixed invalid add_custom_command structure.
227
+ - Man-html CSS: bold and headline color #a02172, links #2376b1, section headings #3f789b, sidebar background #f5f4f0 and border #e0ddd6.
228
+ - CLI help: --css/--style describes use with man-html and -s; -s/--standalone describes man-html behavior (with -s: nav sidebar and full page; without -s: snippet only).
229
+
230
+ ### Fixed
231
+
232
+ - Man pages generated from Markdown no longer convert option hyphens to em dashes; pandoc is invoked with -f markdown-smart so -- stays as literal ASCII double hyphen in roff output.
233
+ - When both MMD inline abbreviations [>(abbr) expansion] and reference-style definitions [>abbr]: expansion appear in the same document, all abbreviations are now wrapped in <abbr> tags instead of only the reference-style ones (inline entries were previously overwritten in the list).
234
+ - Definition list terms and definitions now render with correct content when using "**term**" followed by ":: definition" (previously produced empty <dt></dt><dd></dd>).
235
+ - TOC markers ({{TOC}}, <!--TOC--> and variants) inside inline code (backticks) or inside code blocks (fenced or indented) are no longer expanded; they are left as literal text in the output.
236
+
237
+ ## [0.1.84] - 2026-02-27
238
+
239
+ ### Changed
240
+
241
+ - Homebrew formula bumped to 0.1.83 with updated release checksum
242
+
243
+ ### New
244
+
245
+ - --width flag wraps terminal and terminal256 output to a fixed column width for better integration with terminal file managers and previews
246
+ - Terminal.width metadata and config option lets you set a default wrap width per document instead of relying only on CLI flags
247
+ - Terminal.theme metadata and config option lets documents select a default terminal theme when using -t terminal or -t terminal256
248
+ - Terminal theme list_marker style controls the color and emphasis of bullet and numbered list markers, defaulting to bold bright red when unset
249
+
250
+ ### Improved
251
+
252
+ - Terminal themes can now mark headings, links, code spans, code blocks, blockquotes, and tables as bold with a bold: true flag in theme YAML instead of encoding bold in the color string
253
+ - Span_classes mappings in terminal themes style inline span classes and attribute list classes consistently in terminal and terminal256 output
254
+
255
+ ## [0.1.83] - 2026-02-26
256
+
257
+ ### New
258
+
259
+ - Span_classes theme mapping lets you define styles for inline span classes in terminal and terminal256 output
260
+
261
+ ### Improved
262
+
263
+ - Terminal output now respects classes from inline attribute lists and bracketed spans (e.g. *emphasis*{.tag} and [text]{.tag}) including spans generated by plugins
264
+ - Terminal theme YAML parsing is more robust so existing themes continue to work even when libyaml is unavailable
265
+
266
+ ## [0.1.82] - 2026-02-25
267
+
268
+ ### New
269
+
270
+ - Add -t/--to output formats for html, json, json-filtered/ast-json/ast, markdown/md, mmd, commonmark/cmark, kramdown, gfm, terminal/cli, and terminal256.
271
+ - Add terminal and terminal256 ANSI renderers with theme support and compact list and blockquote formatting for comfortable reading in a TTY.
272
+ - Add --theme option and support for user theme files in ~/.config/apex/terminal/themes/NAME.theme with automatic default.theme selection when no explicit theme is given.
273
+ - Add JSON and AST JSON output points before and after AST filters so external tools can consume either the raw or fully-processed document structure.
274
+
275
+ ### Improved
276
+
277
+ - Improve MultiMarkdown output so TOC markers and escaping work correctly in -t mmd output without breaking MMD-specific syntax.
278
+ - Improve terminal table rendering with Unicode box drawing, column alignment, captions, footer rules, and advanced colspan/rowspan handling that more closely matches advanced_tables behavior.
279
+ - Terminal output now replaces :emoji: patterns with Unicode emoji when in GFM or unified mode, matching HTML behavior.
280
+
281
+ ### Fixed
282
+
283
+ - Replace APEXLTLT placeholders with literal << in terminal table cells so escaped \<< renders correctly in CLI output.
284
+ - Integrate external code highlighters (Pygments/Skylighting) into terminal output when --code-highlight is enabled, using readable pastel styles appropriate for 8-color and 256-color modes.
285
+ - Compact list item spacing and blockquote rendering in terminal output so lists, quotes, and callouts read cleanly without stray blank lines.
286
+
287
+ ## [0.1.81] - 2026-02-23
288
+
289
+ ### New
290
+
291
+ - Tests for extended syntax in indented and fenced code blocks, inline code, nested list lines with 4-space indent, and real indented code without list markers
292
+
293
+ ### Improved
294
+
295
+ - Lines that start with a list marker after 4+ spaces or tab (nested or continuation list lines) are no longer treated as code blocks, so sup/sub and highlight are still applied there
296
+
297
+ ### Fixed
298
+
299
+ - Superscript (^), subscript (~), underline (~text~), strikethrough (~~), and highlight (==) are no longer processed inside indented code blocks (4+ spaces or tab)
300
+ - Extended syntax remains skipped inside fenced code blocks and inline code as before
301
+
302
+ ## [0.1.80] - 2026-02-18
303
+
304
+ ## [0.1.79] - 2026-02-18
305
+
306
+ ### New
307
+
308
+ - IAL attributes for picture formats: webp, avif (emit <picture> with srcset), and video formats: webm, ogg, mp4, mov, m4v (emit <video> with <source> elements)
309
+ - IAL attribute "auto" discovers format variants (2x, 3x, webp, avif, video) from filesystem and expands img to picture/video when files exist
310
+ - Video URLs (mp4, webm, ogg, mov, m4v, ogv) automatically render as <video> elements instead of <img>
311
+ - --[no-]image-captions and --[no-]title-captions-only CLI options to control figure/figcaption wrapping (title-captions-only: only add captions for images with title, alt-only images get no caption)
312
+ - Image URL ending in .* (e.g. ![](image.*)) auto-discovers format variants from filesystem, same as auto attribute
313
+
314
+ ### Improved
315
+
316
+ - Image attribute matching uses URL + alt to disambiguate same-src images when injecting IAL attributes
317
+ - Picture elements with title or alt now get figure/figcaption wrapping when image captions are enabled
318
+
319
+ ### Fixed
320
+
321
+ - TOC HTML structure now produces valid ul > li > ul nesting instead of invalid ul > ul (nested lists inside list items, never ul directly in ul)
322
+ - Image captions from title: ![alt](url "Title caption") now correctly uses the title for figcaption instead of alt text (quoted titles were being stripped by preprocessor before cmark could parse them)
323
+ - Wildcard image syntax (![](image.*)) now expands correctly when document contains image examples in code blocks (e.g. `![](image.*)` in documentation)
324
+ - Truncated </figure> tag in picture output (memcpy used wrong length for "</figcaption></figure>")
325
+ - Invalid HTML5: strip <p> wrapper around figure, video, and picture elements (p may only contain phrasing content)
326
+ - Auto media expansion when replacement exceeds buffer (grow buffer instead of falling back to original img tag)
327
+
328
+ ## [0.1.78] - 2026-02-13
329
+
330
+ ### New
331
+
332
+ - Test added to verify autolinking does not run inside indented code blocks.
333
+
334
+ ### Fixed
335
+
336
+ - Autolink preprocessor now skips indented code blocks (4+ spaces or tab at line start) so URLs inside them are not converted to links.
337
+
338
+ ## [0.1.77] - 2026-02-09
339
+
340
+ ### Fixed
341
+
342
+ - Package.swift missing filters
343
+ - Package.swift missing ast_json
344
+
345
+ ## [0.1.76] - 2026-02-07
346
+
347
+ ### Changed
348
+
349
+ - Formula/apex.rb: version 0.1.75 and release sha256.
350
+
351
+ ### New
352
+
353
+ - Install filter by path: directory JSON can specify "path" (e.g. "contrib/code-includes.lua"); apex clones repo to temp, copies that file to filters/<basename>, then removes temp.
354
+ - Code blocks with info string "inc" emit Pandoc keyvals [["inc","yes"]] in AST JSON so code-includes-style filters can replace block content with file contents.
355
+
356
+ ### Improved
357
+
358
+ - Uninstall: when filter is not a directory, try filters/NAME.lua, NAME.py, NAME.rb and remove that file.
359
+ - Filter resolution: --filter NAME now resolves to filters/NAME, filters/NAME.lua, filters/NAME.py, or filters/NAME.rb (regular files) before trying NAME as a directory.
360
+
361
+ ### Fixed
362
+
363
+ - .lua filters are run via `lua "path"` so scripts without a shebang work.
364
+
365
+ ## [0.1.75] - 2026-02-06
366
+
367
+ ## [0.1.74] - 2026-02-06
368
+
369
+ ### New
370
+
371
+ - AST filters (Pandoc-style JSON): run filters via --filter, --filters, and --lua-filter; apex_options gains ast_filter_commands, ast_filter_count, and ast_filter_strict
372
+ - --install-filter to install AST filters from the apex-filters directory or from a Git URL
373
+ - --no-strict-filters to skip failing filters and invalid filter JSON instead of aborting
374
+ - Div blocks in Pandoc JSON are now parsed (attributes skipped, inner blocks appended to the document)
375
+ - --list-filters lists installed filters (from the user filters directory) and available filters from the central apex-filters directory, with titles, authors, descriptions, and homepages for available entries
376
+ - --uninstall-filter ID removes a filter by id (file or directory) after a confirmation prompt; cannot be combined with --install-filter
377
+
378
+ ### Improved
379
+
380
+ - Silence C compiler narrowing warnings in the abbreviations extension so embedding Apex and building language bindings can run with cleaner, warning-free builds
381
+ - Images already inside a <figure> (e.g. from ::: >figure) are no longer wrapped again in figure/figcaption by the image-caption logic
382
+ - Redundant <p> around a single <img> inside <figure> is stripped so ::: >figure with "< ![Image](...)" yields <figure><img...></figure> without an inner paragraph
383
+ - Pandoc JSON parser accepts block and inline objects with keys in any order (e.g. "c" before "t" as emitted by dkjson/Lua) so filter output from Lua and other generators parses correctly
384
+ - Filter directory JSON parsing is shared for both "plugins" and "filters" arrays; apex_remote_fetch_filters_directory fetches and parses apex-filters.json for list/install
385
+ - Apex_remote_print_plugins_filtered accepts an optional noun so the empty-list message says "filters" when listing filters instead of "plugins"
386
+
387
+ ### Fixed
388
+
389
+ - Pandoc JSON parser now consumes the closing "c" array bracket after Header inlines so multi-block filter output (e.g. unwrap filter with heading plus figure) parses correctly and renders full output
390
+ - Multi-block Pandoc JSON (e.g. Header + RawBlock) now parses to all blocks instead of only the first; parse_blocks_array returns the container and callers adopt its children then free it so the block chain is preserved
391
+
5
392
  ## [0.1.73] - 2026-02-04
6
393
 
7
394
  ### New
@@ -2354,8 +2741,31 @@ Based on [cmark-gfm](https://github.com/github/cmark-gfm) by GitHub
2354
2741
 
2355
2742
  Developed for [Marked](https://marked2app.com) by Brett Terpstra
2356
2743
 
2357
- z
2358
-
2744
+ [0.1.98]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.98
2745
+ [0.1.97]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.97
2746
+ [0.1.96]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.96
2747
+ [0.1.95]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.95
2748
+ [0.1.94]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.94
2749
+ [0.1.93]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.93
2750
+ [0.1.92]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.92
2751
+ [0.1.91]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.91
2752
+ [0.1.90]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.90
2753
+ [0.1.89]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.89
2754
+ [0.1.88]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.88
2755
+ [0.1.87]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.87
2756
+ [0.1.86]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.86
2757
+ [0.1.85]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.85
2758
+ [0.1.84]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.84
2759
+ [0.1.83]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.83
2760
+ [0.1.82]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.82
2761
+ [0.1.81]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.81
2762
+ [0.1.80]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.80
2763
+ [0.1.79]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.79
2764
+ [0.1.78]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.78
2765
+ [0.1.77]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.77
2766
+ [0.1.76]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.76
2767
+ [0.1.75]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.75
2768
+ [0.1.74]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.74
2359
2769
  [0.1.73]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.73
2360
2770
  [0.1.72]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.72
2361
2771
  [0.1.71]: https://github.com/ApexMarkdown/apex/releases/tag/v0.1.71
@@ -6,7 +6,7 @@ if(POLICY CMP0000)
6
6
  endif()
7
7
  set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "Minimum CMake policy version" FORCE)
8
8
 
9
- project(apex VERSION 0.1.73 LANGUAGES C)
9
+ project(apex VERSION 0.1.98 LANGUAGES C)
10
10
 
11
11
  # Set C standard
12
12
  set(CMAKE_C_STANDARD 99)
@@ -108,6 +108,11 @@ endif()
108
108
  # Library source files
109
109
  set(APEX_LIB_SOURCES
110
110
  src/apex.c
111
+ src/ast_json.c
112
+ src/ast_markdown.c
113
+ src/ast_terminal.c
114
+ src/ast_man.c
115
+ src/filters_ast.c
111
116
  src/plugins_env.c
112
117
  src/plugins.c
113
118
  src/plugins_remote.c
@@ -334,6 +339,7 @@ add_executable(apex_test_runner
334
339
  tests/test_helpers.c
335
340
  tests/test_runner.c
336
341
  tests/test_basic.c
342
+ tests/test_cmark_callback.c
337
343
  tests/test_metadata.c
338
344
  tests/test_links.c
339
345
  tests/test_tables.c
@@ -347,8 +353,9 @@ add_executable(apex_test_runner
347
353
  target_link_libraries(apex_test_runner apex_static)
348
354
  target_compile_definitions(apex_test_runner PRIVATE TEST_FIXTURES_DIR="${CMAKE_SOURCE_DIR}/tests/fixtures/includes")
349
355
 
350
- # Add test
356
+ # Add test (run from source dir so fixture paths like tests/fixtures/... resolve)
351
357
  add_test(NAME apex_tests COMMAND apex_test_runner)
358
+ set_tests_properties(apex_tests PROPERTIES WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
352
359
 
353
360
  # Documentation
354
361
  option(BUILD_DOCS "Build documentation" OFF)
@@ -402,24 +409,14 @@ foreach(MAN_PAGE_SPEC ${MAN_PAGES})
402
409
  )
403
410
  set(MAN_AVAILABLE TRUE)
404
411
  else()
405
- # Try to generate man page from Markdown source
406
- if(PANDOC_EXECUTABLE)
407
- add_custom_command(
408
- OUTPUT ${MAN_OUTPUT}
409
- COMMAND ${PANDOC_EXECUTABLE} -s -t man -o ${MAN_OUTPUT} ${MAN_SOURCE}
410
- DEPENDS ${MAN_SOURCE}
411
- COMMENT "Generating man page ${MAN_NAME}.${MAN_SECTION} from Markdown using pandoc"
412
- )
413
- set(MAN_AVAILABLE TRUE)
414
- elseif(GO_MD2MAN_EXECUTABLE)
415
- add_custom_command(
416
- OUTPUT ${MAN_OUTPUT}
417
- COMMAND ${GO_MD2MAN_EXECUTABLE} -in=${MAN_SOURCE} -out=${MAN_OUTPUT}
418
- DEPENDS ${MAN_SOURCE}
419
- COMMENT "Generating man page ${MAN_NAME}.${MAN_SECTION} from Markdown using go-md2man"
420
- )
421
- set(MAN_AVAILABLE TRUE)
422
- endif()
412
+ # Generate with apex -t man (roff); we build apex_cli in this tree
413
+ add_custom_command(
414
+ OUTPUT ${MAN_OUTPUT}
415
+ COMMAND $<TARGET_FILE:apex_cli> -t man ${MAN_SOURCE} > ${MAN_OUTPUT}
416
+ DEPENDS ${MAN_SOURCE} apex_cli
417
+ COMMENT "Generating man page ${MAN_NAME}.${MAN_SECTION} from Markdown using apex -t man"
418
+ )
419
+ set(MAN_AVAILABLE TRUE)
423
420
  endif()
424
421
 
425
422
  # Install man page
@@ -433,18 +430,33 @@ endforeach()
433
430
 
434
431
  # Create a target that depends on all man pages
435
432
  if(MAN_AVAILABLE)
436
- if(PANDOC_EXECUTABLE OR GO_MD2MAN_EXECUTABLE)
437
- add_custom_target(man_pages ALL DEPENDS ${MAN_OUTPUTS})
438
- message(STATUS "Man pages: Will be generated from Markdown sources")
439
- else()
440
- add_custom_target(man_pages_copy ALL DEPENDS ${MAN_OUTPUTS})
441
- message(STATUS "Man pages: Using pre-generated man pages")
442
- endif()
433
+ add_custom_target(man_pages ALL DEPENDS ${MAN_OUTPUTS})
434
+ message(STATUS "Man pages: Will be built from Markdown (apex -t man) or copied if pre-generated")
443
435
  else()
444
- message(WARNING "Pre-generated man pages not found and neither pandoc nor go-md2man available.")
445
- message(STATUS " Man pages will not be installed. Generate them with 'make man' before building.")
436
+ message(WARNING "Man page sources or pre-generated pages not found.")
437
+ message(STATUS " Man pages will not be installed.")
446
438
  endif()
447
439
 
440
+ add_custom_target(swift_package_check
441
+ COMMAND ${CMAKE_COMMAND} -E env
442
+ SWIFT_PACKAGE_PATH=${CMAKE_SOURCE_DIR}
443
+ swift build
444
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
445
+ COMMENT "Building Swift package (debug)"
446
+ )
447
+
448
+ add_custom_target(swift_package_check_release
449
+ COMMAND ${CMAKE_COMMAND} -E env
450
+ SWIFT_PACKAGE_PATH=${CMAKE_SOURCE_DIR}
451
+ swift build -c release
452
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
453
+ COMMENT "Building Swift package (release)"
454
+ )
455
+
456
+ add_custom_target(all_checks
457
+ DEPENDS apex_test_runner swift_package_check swift_package_check_release
458
+ )
459
+
448
460
  # Print configuration
449
461
  message(STATUS "Apex ${PROJECT_VERSION}")
450
462
  message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
@@ -7,14 +7,14 @@
7
7
  class Apex < Formula
8
8
  desc "Unified Markdown processor supporting CommonMark, GFM, MultiMarkdown, and Kramdown"
9
9
  homepage "https://github.com/ApexMarkdown/apex"
10
- version "0.1.73"
10
+ version "0.1.97"
11
11
  license "MIT"
12
12
 
13
13
  depends_on "libyaml"
14
14
 
15
15
  on_macos do
16
16
  url "https://github.com/ApexMarkdown/apex/releases/download/v#{version}/apex-#{version}-macos-universal.tar.gz"
17
- sha256 "cdcdc77d43cff76cd0bca0936f482f4053c0970f65e4165666251ad7e768ade4"
17
+ sha256 "4ca3d97305e94275397dfe9e3803feef7fb98fcbb0e472f56fcc0daff65f0f07"
18
18
  end
19
19
 
20
20
  def install
@@ -13,6 +13,10 @@ let package = Package(
13
13
  .library(
14
14
  name: "Apex",
15
15
  targets: ["Apex"]
16
+ ),
17
+ .library(
18
+ name: "ApexC",
19
+ targets: ["ApexC"]
16
20
  )
17
21
  ],
18
22
  targets: [
@@ -85,6 +89,11 @@ let package = Package(
85
89
  path: ".",
86
90
  sources: [
87
91
  "src/apex.c",
92
+ "src/ast_markdown.c",
93
+ "src/ast_terminal.c",
94
+ "src/ast_man.c",
95
+ "src/filters_ast.c",
96
+ "src/ast_json.c",
88
97
  "src/plugins_env.c",
89
98
  "src/plugins.c",
90
99
  "src/plugins_remote.c",