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
@@ -0,0 +1,459 @@
1
+
2
+ [![Version: 0.1.76](https://img.shields.io/badge/Version-0.1.76-528c9e)](https://github.com/ApexMarkdown/apex/releases/latest) ![](https://img.shields.io/badge/CMake-064F8C?style=for-the-badge&logo=cmake&logoColor=white) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) <!--TESTS_BADGE-->![Tests passing 1314/1314](https://img.shields.io/badge/Tests-1314/1314-a5da78)<!--END TESTS_BADGE-->
3
+
4
+
5
+ # Apex
6
+
7
+
8
+ Apex is a unified Markdown processor that combines the best
9
+ features from CommonMark, GitHub Flavored Markdown (GFM),
10
+ MultiMarkdown, Kramdown, and Marked. One processor to rule
11
+ them all.
12
+
13
+
14
+ ![](apex-header-2-rb@2x.webp)
15
+
16
+
17
+ There are so many variations of
18
+ Markdown, extending its features in all kinds of ways. But
19
+ picking one flavor means giving up the features of another
20
+ flavor. So I'm building Apex with the goal of making all of
21
+ the most popular features of various processors available in
22
+ one tool.
23
+
24
+ ## Features
25
+
26
+ ### Compatibility Modes
27
+
28
+ - **Multiple compatibility modes**: CommonMark, GFM, MultiMarkdown, Kramdown, and Unified (all features)
29
+ - **Mode-specific features**: Each mode enables appropriate extensions for maximum compatibility
30
+
31
+ ### Markdown Extensions
32
+
33
+ - **Tables**: GitHub Flavored Markdown tables with advanced features (rowspan via `^^`, colspan via empty cells/`<<`, captions before/after tables including Pandoc-style `Table: Caption` and `: Caption` syntax, and individual cell alignment using colons `:Left`, `Right:`, `:Center:`)
34
+ - **Table caption positioning**: Control caption placement with `--captions above` or `--captions below` (default: below)
35
+ - **Table caption IAL**: IAL attributes in table captions (e.g., `: Caption {#id .class}`) are extracted and applied to the table element
36
+ - **Relaxed tables**: Support for tables without separator rows (Kramdown-style)
37
+ - **Headerless tables**: Support for tables that start with alignment rows (separator rows) without header rows; column alignment is automatically applied
38
+ - **Footnotes**: Three syntaxes supported (reference-style, Kramdown inline, MultiMarkdown inline)
39
+ - **Definition lists**: Kramdown-style definition lists with Markdown content support
40
+ - **Task lists**: GitHub-style checkboxes (`- [ ]` and `- [x]`)
41
+ - **Strikethrough**: `~~text~~` syntax from GFM
42
+ - **Smart typography**: Automatic conversion of quotes, dashes, ellipses, and more
43
+ - **Math support**: LaTeX math expressions with `$...$` (inline) and `$$...$$` (display)
44
+
45
+ - **Syntax highlighting**: External syntax highlighting for fenced code blocks via Pygments or Skylighting with `--code-highlight` flag.
46
+
47
+ Supports language-aware highlighting, auto-detection, and line numbers with `--code-line-numbers`
48
+
49
+ - **Wiki links**: `[[Page Name]]`, `[[Page Name|Display Text]]`, and `[[Page Name#Section]]` syntax with configurable link targets via `--wikilink-space` and `--wikilink-extension`
50
+ - **Abbreviations**: Three syntaxes (classic MMD, MMD 6 reference, MMD 6 inline)
51
+ - **Callouts**: Bear/Obsidian-style callouts with collapsible support (`> [!NOTE]`, `> [!WARNING]`, etc.)
52
+ - **GitHub emoji**: 350+ emoji support (`:rocket:`, `:heart:`, etc.)
53
+
54
+ ### Document Features
55
+
56
+
57
+
58
+ - **Metadata blocks**: YAML front matter, MultiMarkdown metadata, and Pandoc title blocks
59
+ - **Metadata variables**: Insert metadata values with `[%key]` syntax
60
+ - **Metadata transforms**: Transform metadata values with `[%key:transform]` syntax
61
+
62
+ Supports case conversion, string manipulation, regex replacement, date formatting, and more.
63
+
64
+ See [Metadata Transforms](https://github.com/ApexMarkdown/apex/wiki/Metadata-Transforms) for complete documentation
65
+ - **Metadata control of options**: Control command-line options via metadata
66
+ - set boolean flags (`indices: false`, `wikilinks: true`) and string options (`bibliography: refs.bib`, `title: My Document`, `wikilink-space: dash`, `wikilink-extension: html`) directly in document metadata for per-document configuration
67
+ - **Table of Contents**: Automatic TOC generation with depth control using HTML (`<!--TOC-->`), MMD (`{{TOC}}` / `{{TOC:2-4}}`), and Kramdown `{:toc}` markers. Headings marked with `{:.no_toc}` are excluded from the generated TOC.
68
+ - **File includes**: Three syntaxes (Marked `<<[file]`, MultiMarkdown `{{file}}`, iA Writer `/file`), with support for address ranges and wildcard/glob patterns such as `{{file.*}}`, `{{*.md}}`, and `{{c?de.py}}`.
69
+ - **Markdown combiner (`--combine`)**: Concatenate one or more Markdown files into a single Markdown stream, expanding all include syntaxes.
70
+
71
+ When a `SUMMARY.md` file is provided, Apex treats it as a GitBook-style index and combines the linked files in order, perfect for building books, multi-file indices, and shared tables of contents that can then be piped back into Apex for final rendering.
72
+ - **MultiMarkdown merge (`--mmd-merge`)**: Read one or more mmd_merge-style index files and stitch their referenced documents into a single Markdown stream.
73
+
74
+ Each non-empty, non-comment line specifies a file to include; indentation with tabs or four-space groups shifts all headings in that file down by one level per indent, mirroring the original `mmd_merge.pl` behavior.
75
+
76
+ Output is raw Markdown that can be piped into Apex (e.g., `apex --mmd-merge index.txt | apex --mode mmd`).
77
+
78
+ - **CSV/TSV support**: Automatic table conversion from CSV and TSV files
79
+ - **Inline Attribute Lists (IAL)**: Kramdown-style attributes `{: #id .class}` and Pandoc-style attributes `{#id .class}`
80
+
81
+ Both formats work in all contexts (block-level, inline, paragraphs, headings, table captions)
82
+ - **Bracketed spans**: Convert `[text]{IAL}` syntax to HTML span elements with attributes, enabled by default in unified mode
83
+ - **Fenced divs**: Pandoc-style fenced divs `::::: {#id .class} ... :::::` for creating custom block containers, enabled by default in unified mode.
84
+
85
+ Supports block type syntax `>blocktype` to create different HTML elements (e.g., `::: >aside {.sidebar}` creates `<aside>` instead of `<div>`). Common block types include `aside`, `article`, `section`, `details`, `summary`, `header`, `footer`, `nav`, and custom elements
86
+ - **Image IAL support**: Inline and reference-style images support IAL syntax with automatic width/height conversion (percentages and non-integer/non-px values convert to style attributes, Xpx values convert to integer width/height attributes, bare integers remain as width/height attributes)
87
+ - **Special markers**: Page breaks (`<!--BREAK-->`), autoscroll pauses (`<!--PAUSE:N-->`), end-of-block markers
88
+
89
+
90
+ ### Citations and Bibliography
91
+
92
+ - **Multiple citation syntaxes**: Pandoc (`[@key]`), MultiMarkdown (`[#key]`), and mmark (`[@RFC1234]`) styles
93
+ - **Bibliography formats**: Support for BibTeX (`.bib`), CSL JSON (`.json`), and CSL YAML (`.yml`, `.yaml`) formats
94
+ - **Automatic bibliography generation**: Bibliography automatically generated from cited entries
95
+ - **Citation linking**: Option to link citations to bibliography entries
96
+ - **Metadata support**: Bibliography can be specified in document metadata or via command-line flags
97
+ - **Multiple bibliography files**: Support for loading and merging multiple bibliography files
98
+ - **CSL style support**: Citation Style Language (CSL) files for custom citation formatting
99
+ - **Mode support**: Citations enabled in MultiMarkdown and unified modes
100
+
101
+ ### Indices
102
+
103
+ - **mmark syntax**: `(!item)`, `(!item, subitem)`, `(!!item, subitem)` for primary entries
104
+ - **TextIndex syntax**: `{^}`, `[term]{^}`, `{^params}` for flexible indexing
105
+ - **Automatic index generation**: Index automatically generated at end of document or at `<!--INDEX-->` marker
106
+ - **Alphabetical sorting**: Entries sorted alphabetically with optional grouping by first letter
107
+ - **Hierarchical sub-items**: Support for nested index entries
108
+ - **Mode support**: Indices enabled by default in MultiMarkdown and unified modes
109
+
110
+ ### Critic Markup
111
+
112
+ - **Change tracking**: Additions (`{++text++}`), deletions (`{--text--}`), substitutions (`{~~old~>new~~}`)
113
+ - **Annotations**: Highlights (`{==text==}`) and comments (`{>>text<<}`)
114
+ - **Accept mode**: `--accept` flag to apply all changes for final output
115
+ - **Reject mode**: `--reject` flag to revert all changes to original
116
+
117
+ ### Output Options
118
+
119
+ - **Flexible output**: Compact HTML fragments, pretty-printed HTML, or complete standalone documents
120
+ - **Standalone documents**: Generate complete HTML5 documents with `<html>`, `<head>`, `<body>` tags
121
+ - **Custom styling**: Link multiple external CSS files in standalone mode (use `--css` multiple times or comma-separated list)
122
+ - **Syntax highlighting**: External syntax highlighting via Pygments or Skylighting with `--code-highlight` flag, includes automatic GitHub-style CSS in standalone mode
123
+ - **Pretty-print**: Formatted HTML with proper indentation for readability
124
+ - **Header ID generation**: Automatic or manual header IDs with multiple format options (GFM, MMD, Kramdown)
125
+ - **Emoji-to-name conversion**: In GFM mode, emojis in headers are converted to their textual names in IDs (e.g., `# ???? Support` ??? `id="smile-support"`), matching Pandoc's GFM behavior
126
+ - **Header anchors**: Option to generate `<a>` anchor tags instead of header IDs
127
+ - **ARIA accessibility**: Add ARIA labels and accessibility attributes (`--aria`) for better screen reader support, including aria-label on TOC navigation, role attributes on figures and tables, and aria-describedby linking tables to their captions
128
+
129
+ ### Advanced Features
130
+
131
+ - **Hard breaks**: Option to treat newlines as hard line breaks
132
+ - **Feature toggles**: Granular control to enable/disable specific features (tables, footnotes, math, smart typography, etc.)
133
+ - **Unsafe HTML**: Option to allow or block raw HTML in documents
134
+ - **Autolinks**: Automatic URL detection and linking
135
+ - **Superscript/Subscript**: Support for `^superscript^` and `~subscript~` syntax
136
+
137
+ ### Extensibility and Plugins
138
+
139
+ Apex supports a flexible plugin system that lets you add new syntax and post-processing features in any language while keeping the core parser stable and fast. Plugins are disabled by default so there is no performance impact unless you opt in. Enable them per run with `--plugins`, or per document with a `plugins: true` (or `enable-plugins: true`) key in your metadata.
140
+
141
+ You can manage plugins from the CLI:
142
+
143
+ - Install plugins with `--install-plugin`:
144
+
145
+ From the central directory using an ID: `--install-plugin kbd`
146
+
147
+ Directly from a Git URL or GitHub shorthand: `--install-plugin https://github.com/user/repo.git` or `--install-plugin user/repo`
148
+
149
+ - Uninstall a local plugin with `--uninstall-plugin ID`.
150
+ - See installed and available plugins with `--list-plugins`.
151
+
152
+ When installing from a direct Git URL or GitHub repo name,
153
+ Apex will prompt with a security warning before cloning,
154
+ since plugins execute unverified code.
155
+
156
+ For a complete guide to writing, installing, and publishing plugins, see the [Plugins](https://github.com/ApexMarkdown/apex/wiki/Plugins) page in the Apex Wiki.
157
+
158
+ ## Installation
159
+
160
+ ### Homebrew (macOS/Linux)
161
+
162
+ ```bash
163
+ brew tap ttscoff/thelab
164
+ brew install ttscoff/thelab/apex
165
+
166
+ ```
167
+
168
+ ### Building from Source
169
+
170
+ ```bash
171
+ git clone https://github.com/ApexMarkdown/apex.git
172
+ cd apex
173
+ git submodule update --init --recursive
174
+ make
175
+
176
+ ```
177
+
178
+ The `apex` binary will be in the `build/` directory.
179
+
180
+ To install the built binary and libraries system-wide:
181
+
182
+ ```bash
183
+ make install
184
+
185
+ ```
186
+
187
+ **Note:** The default `make` command runs both `cmake -S . -B build` (to configure the project) and `cmake --build build` (to compile). If you prefer to run cmake commands directly, you can use those instead.
188
+
189
+ ### Pre-built Binaries
190
+
191
+ Download pre-built binaries from the [latest release](https://github.com/ApexMarkdown/apex/releases/latest). Binaries are available for:
192
+
193
+ - macOS (Universal binary for arm64 and x86_64)
194
+ - Linux (x86_64 and arm64)
195
+
196
+ ## Basic Usage
197
+
198
+ ### Command Line
199
+
200
+ ```bash
201
+ # Process a markdown file
202
+ apex input.md
203
+
204
+ # Output to a file
205
+ apex input.md -o output.html
206
+
207
+ # Generate standalone HTML document
208
+ apex input.md --standalone --title "My Document"
209
+
210
+ # Pretty-print HTML output
211
+ apex input.md --pretty
212
+
213
+ ```
214
+
215
+ ### Processing Modes
216
+
217
+ Apex supports multiple compatibility modes:
218
+
219
+ - `--mode commonmark` - Pure CommonMark specification
220
+ - `--mode gfm` - GitHub Flavored Markdown
221
+
222
+ `--mode mmd` or `--mode multimarkdown` - MultiMarkdown compatibility
223
+
224
+ - `--mode kramdown` - Kramdown compatibility
225
+ - `--mode unified` - All features enabled (default)
226
+
227
+ ```bash
228
+ # Use GFM mode
229
+ apex input.md --mode gfm
230
+
231
+ # Use Kramdown mode with relaxed tables
232
+ apex input.md --mode kramdown
233
+
234
+ ```
235
+
236
+ ### Common Options
237
+
238
+ - `--pretty` - Pretty-print HTML with indentation
239
+
240
+ `--standalone` - Generate complete HTML document with `<html>`, `<head>`, `<body>`
241
+
242
+ `--style FILE` / `--css FILE` - Link to CSS file(s) in document head (requires `--standalone`). Can be used multiple times or with comma-separated list (e.g., `--css style.css --css syntax.css` or `--css style.css,syntax.css`)
243
+
244
+ `--embed-css` - Embed CSS file contents as inline `<style>` tags instead of `<link>` tags (works with multiple stylesheets)
245
+
246
+ - `--title TITLE` - Document title (requires `--standalone`)
247
+ - `--relaxed-tables` - Enable relaxed table parsing (default
248
+
249
+ in unified/kramdown modes)
250
+
251
+ - `--no-relaxed-tables` - Disable relaxed table parsing
252
+
253
+ `--captions POSITION` - Table caption position: `above` or `below` (default: `below`)
254
+
255
+ `--id-format FORMAT` - Header ID format: `gfm`, `mmd`, or `kramdown`
256
+
257
+ - `--no-ids` - Disable automatic header ID generation
258
+ - `--header-anchors` - Generate `<a>` anchor tags instead of
259
+
260
+ header IDs
261
+
262
+ - `--aria` - Add ARIA labels and accessibility attributes to
263
+
264
+ HTML output
265
+
266
+ - `--bibliography FILE` - Bibliography file (BibTeX, CSL
267
+
268
+ JSON, or CSL YAML) - can be used multiple times
269
+
270
+ - `--csl FILE` - Citation style file (CSL format)
271
+
272
+ `--link-citations` - Link citations to bibliography entries
273
+
274
+ - `--indices` - Enable index processing (mmark and TextIndex
275
+
276
+ syntax)
277
+
278
+ - `--no-indices` - Disable index processing
279
+ - `--no-index` - Suppress index generation (markers still
280
+
281
+ created)
282
+
283
+ `--wikilinks` - Enable wiki link syntax `[[Page]]`, `[[Page|Display]]`, and `[[Page#Section]]`
284
+
285
+ `--wikilink-space MODE` - Control how spaces in wiki link page names are converted (`dash`, `none`, `underscore`, `space`; default: `dash`)
286
+
287
+ `--wikilink-extension EXT` - File extension to append to wiki link URLs (e.g. `html`, `md`)
288
+
289
+ - `--divs` / `--no-divs` - Enable/disable Pandoc fenced divs
290
+
291
+ syntax (enabled by default in unified mode)
292
+
293
+ `--spans` / `--no-spans` - Enable/disable bracketed spans `[text]{IAL}` syntax (enabled by default in unified mode)
294
+
295
+ `--code-highlight TOOL` - Use external tool for syntax highlighting (supports `pygments`/`p`/`pyg` or `skylighting`/`s`/`sky`). Automatically includes GitHub-style CSS in standalone mode
296
+
297
+ `--code-line-numbers` - Include line numbers in syntax-highlighted code blocks (requires `--code-highlight`)
298
+
299
+ ### All Options
300
+
301
+ ```
302
+ Apex Markdown Processor v0.1.75
303
+ One Markdown processor to rule them all
304
+
305
+ Project homepage: https://github.com/ApexMarkdown/apex
306
+
307
+ Usage: build/apex [options] [file]
308
+ build/apex --combine [files...]
309
+ build/apex --mmd-merge [index files...]
310
+
311
+ Options:
312
+ --accept Accept all Critic Markup changes (apply edits)
313
+ --[no-]alpha-lists Support alpha list markers (a., b., c. and A., B., C.)
314
+ --[no-]autolink Enable autolinking of URLs and email addresses
315
+ --base-dir DIR Base directory for resolving relative paths (for images, includes, wiki links)
316
+ --bibliography FILE Bibliography file (BibTeX, CSL JSON, or CSL YAML) - can be used multiple times
317
+ --captions POSITION Table caption position: above or below (default: below)
318
+ --code-highlight TOOL Use external tool for syntax highlighting (pygments, skylighting, or abbreviations p, s)
319
+ --code-line-numbers Include line numbers in syntax-highlighted code blocks (requires --code-highlight)
320
+ --highlight-language-only Only highlight code blocks that have a language specified (requires --code-highlight)
321
+ --combine Concatenate Markdown files (expanding includes) into a single Markdown stream
322
+ When a SUMMARY.md file is provided, treat it as a GitBook index and combine
323
+ the linked files in order. Output is raw Markdown suitable for piping back into Apex.
324
+ --csl FILE Citation style file (CSL format)
325
+ --css FILE, --style FILE Link to CSS file(s) in document head (requires --standalone, overrides CSS metadata)
326
+ Can be used multiple times or accept comma-separated list (e.g., --css style.css,syntax.css)
327
+ --embed-css Embed CSS file contents into a <style> tag in the document head (used with --css)
328
+ --embed-images Embed local images as base64 data URLs in HTML output
329
+ --hardbreaks Treat newlines as hard breaks
330
+ --header-anchors Generate <a> anchor tags instead of header IDs
331
+ -h, --help Show this help message
332
+ --id-format FORMAT Header ID format: gfm (default), mmd, or kramdown
333
+ (modes auto-set format; use this to override in unified mode)
334
+ --[no-]includes Enable file inclusion (enabled by default in unified mode)
335
+ --indices Enable index processing (mmark, TextIndex, and Leanpub syntax)
336
+ --install-plugin ID Install plugin by id from directory, or by Git URL/GitHub shorthand (user/repo)
337
+ --list-filters List installed filters and available filters from the remote directory
338
+ --install-filter ID Install AST filter by id from the central filters directory or by Git URL/GitHub shorthand
339
+ --uninstall-filter ID Uninstall filter by id
340
+ --filter NAME Run a single AST filter from ~/.config/apex/filters/NAME (Pandoc-style JSON filter)
341
+ --filters Run all executable filters in ~/.config/apex/filters (sorted by name)
342
+ --lua-filter FILE Run a Lua script as an AST filter via 'lua FILE' (Pandoc-style JSON filter)
343
+ --no-strict-filters Do not abort on AST filter errors/invalid JSON; skip failing filters instead
344
+ --link-citations Link citations to bibliography entries
345
+ --list-plugins List installed plugins and available plugins from the remote directory
346
+ --uninstall-plugin ID Uninstall plugin by id
347
+ --meta KEY=VALUE Set metadata key-value pair (can be used multiple times, supports quotes and comma-separated pairs)
348
+ --meta-file FILE Load metadata from external file (YAML, MMD, or Pandoc format)
349
+ --[no-]mixed-lists Allow mixed list markers at same level (inherit type from first item)
350
+ --mmd-merge Merge files from one or more mmd_merge-style index files into a single Markdown stream
351
+ Index files list document parts line-by-line; indentation controls header level shifting.
352
+ -m, --mode MODE Processor mode: commonmark, gfm, mmd, kramdown, unified (default)
353
+ --no-bibliography Suppress bibliography output
354
+ --no-footnotes Disable footnote support
355
+ --no-ids Disable automatic header ID generation
356
+ --no-indices Disable index processing
357
+ --no-index Suppress index generation (markers still created)
358
+ --no-math Disable math support
359
+ --aria Add ARIA labels and accessibility attributes to HTML output
360
+ --no-plugins Disable external/plugin processing
361
+ --no-relaxed-tables Disable relaxed table parsing
362
+ --no-smart Disable smart typography
363
+ --no-sup-sub Disable superscript/subscript syntax
364
+ --[no-]divs Enable or disable Pandoc fenced divs (Unified mode only)
365
+ --[no-]spans Enable or disable bracketed spans [text]{IAL} (Pandoc-style, enabled by default in unified mode)
366
+ --no-tables Disable table support
367
+ --no-transforms Disable metadata variable transforms
368
+ --no-unsafe Disable raw HTML in output
369
+ --no-wikilinks Disable wiki link syntax
370
+ --[no-]emoji-autocorrect Enable/disable emoji name autocorrect (enabled by default in unified mode)
371
+ --obfuscate-emails Obfuscate email links/text using HTML entities
372
+ -o, --output FILE Write output to FILE instead of stdout
373
+ --[no-]progress Show progress indicator during processing (enabled by default for TTY)
374
+ --plugins Enable external/plugin processing
375
+ --pretty Pretty-print HTML with indentation and whitespace
376
+ --reject Reject all Critic Markup changes (revert edits)
377
+ --[no-]relaxed-tables Enable or disable relaxed table parsing (no separator rows required)
378
+ --[no-]per-cell-alignment Enable or disable per-cell alignment markers (colons at start/end of cells, enabled by default in unified mode)
379
+ --script VALUE Inject <script> tags before </body> (standalone) or at end of HTML (snippet).
380
+ VALUE can be a path, URL, or shorthand (mermaid, mathjax, katex). Can be used multiple times or as a comma-separated list.
381
+ --show-tooltips Show tooltips on citations
382
+ -s, --standalone Generate complete HTML document (with <html>, <head>, <body>)
383
+ --[no-]sup-sub Enable or disable MultiMarkdown-style superscript (^text^) and subscript (~text~) syntax
384
+ --[no-]strikethrough Enable or disable GFM-style ~~strikethrough~~ processing
385
+ --title TITLE Document title (requires --standalone, default: "Document")
386
+ --[no-]transforms Enable or disable metadata variable transforms [%key:transform]
387
+ --[no-]unsafe Allow or disallow raw HTML in output
388
+ --widont Prevent short widows in headings by inserting non-breaking spaces between trailing words
389
+ --code-is-poetry Treat unlanguaged code blocks as poetry (adds 'poetry' class, implies --highlight-language-only)
390
+ --[no-]markdown-in-html Enable or disable markdown processing inside HTML blocks with markdown attributes
391
+ --random-footnote-ids Use hash-based footnote IDs to avoid collisions when combining documents
392
+ --hashtags Convert #tags into span-wrapped hashtags
393
+ --style-hashtags Use 'mkstyledtag' class instead of 'mkhashtag' for hashtags
394
+ --proofreader Treat ==highlight== and ~~delete~~ as CriticMarkup highlight/deletion
395
+ --hr-page-break Replace <hr> elements with Marked-style page break divs
396
+ --title-from-h1 Use the first H1 as the document title when none is specified
397
+ --page-break-before-footnotes Insert a page break before the footnotes section
398
+ -v, --version Show version information
399
+ --[no-]wikilinks Enable or disable wiki link syntax [[PageName]]
400
+ --wikilink-space MODE Space replacement for wiki links: dash, none, underscore, space (default: dash)
401
+ --wikilink-extension EXT File extension to append to wiki links (e.g., html, md)
402
+ --[no-]wikilink-sanitize Sanitize wiki link URLs (lowercase, remove apostrophes, etc.)
403
+
404
+ If no file is specified, reads from stdin.
405
+
406
+ ```
407
+
408
+ ### Per-Document Configuration via Metadata
409
+
410
+ Most command-line options can be controlled via document
411
+ metadata, allowing different files to be processed with
412
+ different settings when processing batches. Boolean options
413
+ accept `true`/`false`, `yes`/`no`, or `1`/`0`
414
+ (case-insensitive). String options use the value directly.
415
+
416
+ **Example:**
417
+
418
+ ```yaml
419
+ ---
420
+ indices: false
421
+ wikilinks: true
422
+ bibliography: references.bib
423
+ title: My Research Paper
424
+ pretty: true
425
+ standalone: true
426
+ ---
427
+
428
+ ```
429
+
430
+ This allows you to process multiple files with `apex *.md` and have each file use its own configuration. You can also use `--meta-file` to specify a shared configuration file that applies to all processed files.
431
+
432
+ ## Documentation
433
+
434
+ For complete documentation, see the [Apex Wiki](https://github.com/ApexMarkdown/apex/wiki).
435
+
436
+ Key documentation pages:
437
+
438
+ [Citations and Bibliography](https://github.com/ApexMarkdown/apex/wiki/Citations) - Complete guide to citations and bibliographies
439
+
440
+ [Command Line Options](https://github.com/ApexMarkdown/apex/wiki/Command-Line-Options) - All CLI flags explained
441
+
442
+ [Syntax Reference](https://github.com/ApexMarkdown/apex/wiki/Syntax) - Complete syntax reference
443
+
444
+ ## Contributing
445
+
446
+ Contributions are welcome! Please feel free to submit a Pull
447
+ Request.
448
+
449
+ Please note the [tests requirement for new features](https://github.com/ApexMarkdown/apex/wiki/Writing-Tests).
450
+
451
+ 1. Fork the [repository](https://github.com/ApexMarkdown/apex)
452
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
453
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
454
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
455
+ 5. Open a Pull Request
456
+
457
+ ## License
458
+
459
+ This project is licensed under the MIT License - see the [LICENSE]([LICENSE](https://github.com/ApexMarkdown/apex/blob/main/LICENSE)) file for details.
@@ -1,5 +1,5 @@
1
1
  <!--README-->
2
- [![Version: <!--VER-->0.1.72<!--END VER-->](https://img.shields.io/badge/Version-<!--VER-->0.1.72<!--END VER-->-528c9e)](https://github.com/ApexMarkdown/apex/releases/latest) ![](https://img.shields.io/badge/CMake-064F8C?style=for-the-badge&logo=cmake&logoColor=white) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) <!--TESTS_BADGE-->![Tests passing 1304/1304](https://img.shields.io/badge/Tests-1304/1304-a5da78)<!--END TESTS_BADGE-->
2
+ [![Version: <!--VER-->0.1.97<!--END VER-->](https://img.shields.io/badge/Version-<!--VER-->0.1.97<!--END VER-->-528c9e)](https://github.com/ApexMarkdown/apex/releases/latest) ![](https://img.shields.io/badge/CMake-064F8C?style=for-the-badge&logo=cmake&logoColor=white) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) <!--TESTS_BADGE-->![Tests passing 1475/1475](https://img.shields.io/badge/Tests-1475/1475-a5da78)<!--END TESTS_BADGE-->
3
3
 
4
4
  <!--GITHUB-->
5
5
  # Apex
@@ -42,7 +42,7 @@ one tool.
42
42
  - **Smart typography**: Automatic conversion of quotes, dashes, ellipses, and more
43
43
  - **Math support**: LaTeX math expressions with `$...$` (inline) and `$$...$$` (display)
44
44
 
45
- - **Syntax highlighting**: External syntax highlighting for fenced code blocks via Pygments or Skylighting with `--code-highlight` flag.
45
+ - **Syntax highlighting**: External syntax highlighting for fenced code blocks via Pygments, Skylighting, or Shiki with `--code-highlight` flag.
46
46
 
47
47
  Supports language-aware highlighting, auto-detection, and line numbers with `--code-line-numbers`
48
48
 
@@ -119,7 +119,7 @@ one tool.
119
119
  - **Flexible output**: Compact HTML fragments, pretty-printed HTML, or complete standalone documents
120
120
  - **Standalone documents**: Generate complete HTML5 documents with `<html>`, `<head>`, `<body>` tags
121
121
  - **Custom styling**: Link multiple external CSS files in standalone mode (use `--css` multiple times or comma-separated list)
122
- - **Syntax highlighting**: External syntax highlighting via Pygments or Skylighting with `--code-highlight` flag, includes automatic GitHub-style CSS in standalone mode
122
+ - **Syntax highlighting**: External syntax highlighting via Pygments, Skylighting, or Shiki with `--code-highlight` flag, includes automatic GitHub-style CSS in standalone mode
123
123
  - **Pretty-print**: Formatted HTML with proper indentation for readability
124
124
  - **Header ID generation**: Automatic or manual header IDs with multiple format options (GFM, MMD, Kramdown)
125
125
  - **Emoji-to-name conversion**: In GFM mode, emojis in headers are converted to their textual names in IDs (e.g., `# 😄 Support` → `id="smile-support"`), matching Pandoc's GFM behavior
@@ -292,7 +292,7 @@ apex input.md --mode kramdown
292
292
 
293
293
  `--spans` / `--no-spans` - Enable/disable bracketed spans `[text]{IAL}` syntax (enabled by default in unified mode)
294
294
 
295
- `--code-highlight TOOL` - Use external tool for syntax highlighting (supports `pygments`/`p`/`pyg` or `skylighting`/`s`/`sky`). Automatically includes GitHub-style CSS in standalone mode
295
+ `--code-highlight TOOL` - Use external tool for syntax highlighting (supports `pygments`/`p`/`pyg`, `skylighting`/`s`/`sky`, or `shiki`/`sh`). Uses HTML or ANSI output based on destination format. Automatically includes GitHub-style CSS in standalone mode
296
296
 
297
297
  `--code-line-numbers` - Include line numbers in syntax-highlighted code blocks (requires `--code-highlight`)
298
298