apex-ruby 1.0.17 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -3
- data/ext/apex_ext/apex_ext.c +260 -91
- data/ext/apex_ext/apex_src/CHANGELOG.md +440 -0
- data/ext/apex_ext/apex_src/CMakeLists.txt +15 -1
- data/ext/apex_ext/apex_src/Formula/apex.rb +7 -2
- data/ext/apex_ext/apex_src/Package.swift +15 -4
- data/ext/apex_ext/apex_src/README.md +94 -35
- data/ext/apex_ext/apex_src/VERSION +1 -1
- data/ext/apex_ext/apex_src/apex-debug.log +4 -0
- data/ext/apex_ext/apex_src/apex.code-workspace +38 -0
- data/ext/apex_ext/apex_src/apex.taskpaper +12 -0
- data/ext/apex_ext/apex_src/apex_deflist_debug.log +25 -0
- data/ext/apex_ext/apex_src/buildnotes.md +1435 -0
- data/ext/apex_ext/apex_src/cli/main.c +262 -33
- data/ext/apex_ext/apex_src/debug.log +7 -0
- data/ext/apex_ext/apex_src/docs/CITATIONS_EXAMPLES.md +274 -0
- data/ext/apex_ext/apex_src/docs/CITATIONS_IMPLEMENTATION_PLAN.md +749 -0
- data/ext/apex_ext/apex_src/docs/CITATIONS_PLAN.md +744 -0
- data/ext/apex_ext/apex_src/docs/INDEX_IMPLEMENTATION_ANALYSIS.md +382 -0
- data/ext/apex_ext/apex_src/docs/plans/2025-02-27-man-page-output-implementation.md +351 -0
- data/ext/apex_ext/apex_src/docs/superpowers/plans/2026-07-12-toc-output-format.md +745 -0
- data/ext/apex_ext/apex_src/docs/superpowers/plans/2026-07-18-bear-image-attributes.md +829 -0
- data/ext/apex_ext/apex_src/docs/superpowers/plans/2026-07-19-apex-node-npm.md +1148 -0
- data/ext/apex_ext/apex_src/docs/superpowers/specs/2026-07-12-toc-output-format-design.md +161 -0
- data/ext/apex_ext/apex_src/docs/superpowers/specs/2026-07-18-bear-image-attributes-design.md +184 -0
- data/ext/apex_ext/apex_src/docs/superpowers/specs/2026-07-19-apex-node-npm-design.md +211 -0
- data/ext/apex_ext/apex_src/documentation/app-settings-table.md +67 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Citations.md +340 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Credits.md +11 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Header-IDs.md +234 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Inline-Attribute-Lists.md +516 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Metadata-Transforms.md +461 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Modes.md +193 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Multi-File-Documents.md +201 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Plugins.md +678 -0
- data/ext/apex_ext/apex_src/documentation/app-transformed/Syntax.md +1367 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex Command Line Options.cheatsheet.txt +6 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/C-API.html +774 -300
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Callouts.html +1194 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Citations.html +416 -216
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Command-Line-Options.html +3544 -1094
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Configuration.html +371 -97
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Credits.html +153 -23
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Examples.html +358 -124
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Filters.html +1656 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Generating-Man-Pages.html +1226 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Getting-Started.html +201 -56
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Header-IDs.html +279 -109
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Home.html +200 -53
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Indices.html +2327 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Inline-Attribute-Lists.html +690 -271
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Installation.html +201 -55
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Limitations-and-Roadmap.html +238 -68
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Metadata-Transforms.html +421 -221
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Modes.html +340 -78
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Multi-File-Documents.html +251 -86
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Multi-Format-Images.html +1362 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Pandoc-Integration.html +277 -90
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Plugins.html +673 -346
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Quarto-Mode.html +1405 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Rendering-Markdown-In-Terminal.html +1902 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Syntax.html +1939 -1698
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Tables.html +1781 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Troubleshooting.html +315 -140
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Usage.html +307 -113
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Using-Apex-with-Jekyll.html +1132 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Writing-Tests.html +1754 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Xcode-Integration.html +872 -376
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/docSet.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/html/apex-app-docs.html +8746 -0
- data/ext/apex_ext/apex_src/documentation/shared_styles.css +20 -15
- data/ext/apex_ext/apex_src/documentation/transform_for_app.md +55 -0
- data/ext/apex_ext/apex_src/escaping-repro.md +103 -0
- data/ext/apex_ext/apex_src/examples/quick-actions/Markdown to RTF.workflow/Contents/Info.plist +8 -0
- data/ext/apex_ext/apex_src/examples/quick-actions/Markdown to RTF.workflow/Contents/QuickLook/Preview.png +0 -0
- data/ext/apex_ext/apex_src/examples/quick-actions/Markdown to RTF.workflow/Contents/document.wflow +547 -0
- data/ext/apex_ext/apex_src/examples/quick-actions/Markdown-to-RTF.workflow.zip +0 -0
- data/ext/apex_ext/apex_src/examples/quick-actions/README.md +33 -0
- data/ext/apex_ext/apex_src/include/apex/apex.h +92 -6
- data/ext/apex_ext/apex_src/include/apex/ast_rtf.h +23 -0
- data/ext/apex_ext/apex_src/include/apex/ast_terminal.h +6 -0
- data/ext/apex_ext/apex_src/include/apex/module.modulemap +5 -0
- data/ext/apex_ext/apex_src/include/apex/plugins.h +105 -0
- data/ext/apex_ext/apex_src/include/apexc.h +1 -0
- data/ext/apex_ext/apex_src/man/apex.1 +82 -78
- data/ext/apex_ext/apex_src/man/apex.1.md +81 -4
- data/ext/apex_ext/apex_src/objc/Apex.swift +73 -0
- data/ext/apex_ext/apex_src/objc/ApexPlugins.swift +79 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.h +83 -5
- data/ext/apex_ext/apex_src/objc/NSString+Apex.m +244 -1
- data/ext/apex_ext/apex_src/objc/NSString+ApexPlugins.h +76 -0
- data/ext/apex_ext/apex_src/objc/NSString+ApexPlugins.m +169 -0
- data/ext/apex_ext/apex_src/output.html +87 -0
- data/ext/apex_ext/apex_src/plans/quarto-mode.md +442 -0
- data/ext/apex_ext/apex_src/src/_README.md +85 -32
- data/ext/apex_ext/apex_src/src/apex.c +770 -200
- data/ext/apex_ext/apex_src/src/ast_rtf.c +848 -0
- data/ext/apex_ext/apex_src/src/ast_terminal.c +184 -7
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.c +10 -3
- data/ext/apex_ext/apex_src/src/extensions/advanced_tables.c +7 -11
- data/ext/apex_ext/apex_src/src/extensions/bear_image_attrs.c +467 -0
- data/ext/apex_ext/apex_src/src/extensions/bear_image_attrs.h +27 -0
- data/ext/apex_ext/apex_src/src/extensions/callouts.c +400 -4
- data/ext/apex_ext/apex_src/src/extensions/callouts.h +15 -5
- data/ext/apex_ext/apex_src/src/extensions/citations.c +26 -5
- data/ext/apex_ext/apex_src/src/extensions/code_fence_attrs.c +632 -0
- data/ext/apex_ext/apex_src/src/extensions/code_fence_attrs.h +22 -0
- data/ext/apex_ext/apex_src/src/extensions/concordance.c +632 -0
- data/ext/apex_ext/apex_src/src/extensions/definition_list.c +129 -15
- data/ext/apex_ext/apex_src/src/extensions/grid_tables.c +1050 -121
- data/ext/apex_ext/apex_src/src/extensions/html_markdown.c +569 -16
- data/ext/apex_ext/apex_src/src/extensions/ial.c +502 -52
- data/ext/apex_ext/apex_src/src/extensions/ial.h +2 -1
- data/ext/apex_ext/apex_src/src/extensions/includes.c +532 -33
- data/ext/apex_ext/apex_src/src/extensions/includes.h +7 -1
- data/ext/apex_ext/apex_src/src/extensions/index.c +1427 -140
- data/ext/apex_ext/apex_src/src/extensions/index.h +28 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.c +200 -161
- data/ext/apex_ext/apex_src/src/extensions/quarto_diagrams.c +251 -0
- data/ext/apex_ext/apex_src/src/extensions/quarto_diagrams.h +22 -0
- data/ext/apex_ext/apex_src/src/extensions/quarto_lists.c +624 -0
- data/ext/apex_ext/apex_src/src/extensions/quarto_lists.h +35 -0
- data/ext/apex_ext/apex_src/src/extensions/quarto_polish.c +264 -0
- data/ext/apex_ext/apex_src/src/extensions/quarto_polish.h +23 -0
- data/ext/apex_ext/apex_src/src/extensions/quarto_shortcodes.c +307 -0
- data/ext/apex_ext/apex_src/src/extensions/quarto_shortcodes.h +21 -0
- data/ext/apex_ext/apex_src/src/extensions/raw_content.c +351 -0
- data/ext/apex_ext/apex_src/src/extensions/raw_content.h +20 -0
- data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.c +117 -3
- data/ext/apex_ext/apex_src/src/extensions/special_markers.c +53 -0
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.c +23 -1
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.c +83 -92
- data/ext/apex_ext/apex_src/src/extensions/toc.c +446 -25
- data/ext/apex_ext/apex_src/src/extensions/toc.h +26 -1
- data/ext/apex_ext/apex_src/src/extensions/wiki_links.c +28 -0
- data/ext/apex_ext/apex_src/src/html_renderer.c +387 -17
- data/ext/apex_ext/apex_src/src/plugin_catalog.c +517 -0
- data/ext/apex_ext/apex_src/src/plugins_remote.c +88 -14
- data/ext/apex_ext/apex_src/src/plugins_remote.h +34 -0
- data/ext/apex_ext/apex_src/src/pretty_html.c +6 -1
- data/ext/apex_ext/apex_src/tests/fixtures/comprehensive_test.md +21 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/bear_image_attributes.md +10 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/sections.md +19 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/sections.txt +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/minimal_pb.md +2 -0
- data/ext/apex_ext/apex_src/tests/fixtures/obsidian-callouts.md +46 -0
- data/ext/apex_ext/apex_src/tests/fixtures/pagebreak_html_repro.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/python-callouts.md +47 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/callouts.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/code-attrs.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/diagrams.md +8 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/lists.md +19 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/raw-content.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/shortcodes.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/smoke.md +81 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto/spans.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/quarto-callouts.md +47 -0
- data/ext/apex_ext/apex_src/tests/fixtures/speed.md +192 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/grid-tables.md +37 -0
- data/ext/apex_ext/apex_src/tests/paginate_cli_test.sh +16 -0
- data/ext/apex_ext/apex_src/tests/test_bear_image_attrs.c +301 -0
- data/ext/apex_ext/apex_src/tests/test_concordance.tsv +4 -0
- data/ext/apex_ext/apex_src/tests/test_escaping_repro.c +82 -0
- data/ext/apex_ext/apex_src/tests/test_extensions.c +821 -1
- data/ext/apex_ext/apex_src/tests/test_ial.c +7 -0
- data/ext/apex_ext/apex_src/tests/test_marked_integration.c +25 -0
- data/ext/apex_ext/apex_src/tests/test_metadata.c +129 -0
- data/ext/apex_ext/apex_src/tests/test_output.c +568 -2
- data/ext/apex_ext/apex_src/tests/test_runner.c +11 -0
- data/ext/apex_ext/apex_src/tests/test_tables.c +420 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CMakeLists.txt +1 -1
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.c +77 -1
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.c +135 -5
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/blocks.c +56 -1
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/config.h +38 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/main.c +1 -1
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/__pycache__/cmark.cpython-314.pyc +0 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/__pycache__/normalize.cpython-314.pyc +0 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions.txt +69 -0
- data/ext/apex_ext/apex_src/xcode_build/CMakeScripts/ReRunCMake.make +74 -0
- data/ext/apex_ext/apex_src/xcode_build/CTestTestfile.cmake +22 -0
- data/ext/apex_ext/apex_src/xcode_build/Debug/Apex.framework/Versions/A/Apex +0 -0
- data/ext/apex_ext/apex_src/xcode_build/Debug/Apex.framework/Versions/A/Resources/Info.plist +44 -0
- data/ext/apex_ext/apex_src/xcode_build/Debug/Apex.framework/Versions/A/_CodeSignature/CodeResources +128 -0
- data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.pbxproj +5118 -0
- data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.xcworkspace/xcuserdata/ttscoff.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/project.xcworkspace/xcuserdata/ttscoff.xcuserdatad/WorkspaceSettings.xcsettings +8 -0
- data/ext/apex_ext/apex_src/xcode_build/apex.xcodeproj/xcuserdata/ttscoff.xcuserdatad/xcschemes/xcschememanagement.plist +99 -0
- data/ext/apex_ext/apex_src/xcode_build/cmake_install.cmake +452 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/CMakeScripts/ReRunCMake.make +52 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/cmake_install.cmake +55 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/cmark-gfm.xcodeproj/project.pbxproj +2455 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/cmark-gfm.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/extensions/cmake_install.cmake +171 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/man/cmake_install.cmake +55 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/cmake_install.cmake +220 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/cmark-gfm_export.h +43 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/cmark-gfm_version.h +7 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/config.h +76 -0
- data/ext/apex_ext/apex_src/xcode_build/vendor/cmark-gfm/src/libcmark-gfm.pc +10 -0
- data/ext/apex_ext/extconf.rb +35 -0
- data/lib/apex/version.rb +2 -2
- metadata +117 -2
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/tempOptimizedIndex.dsidx +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Design: `-t toc` Output Format
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-07-12
|
|
4
|
+
**Status:** Approved for implementation
|
|
5
|
+
|
|
6
|
+
## Summary
|
|
7
|
+
|
|
8
|
+
Add a `toc` output format that emits nothing but a Markdown unordered list of document headings, each linked to its header ID. Depth defaults to `#`–`###`, overridable via a single `--toc-min-max` option that also seeds HTML TOC markers when they do not specify their own range.
|
|
9
|
+
|
|
10
|
+
## Goals
|
|
11
|
+
|
|
12
|
+
- `-t toc` / `--to toc` outputs only a nested Markdown TOC.
|
|
13
|
+
- Header IDs match `--id-format` (and manual IDs from `{#id}` / IAL).
|
|
14
|
+
- Default depth is levels 1–3.
|
|
15
|
+
- One CLI flag `--toc-min-max=MIN,MAX` controls defaults for both `-t toc` and marker-based HTML TOC.
|
|
16
|
+
- Marker-specific min/max still overrides the defaults for that marker.
|
|
17
|
+
- Headings with `.no_toc` are excluded (same as HTML TOC).
|
|
18
|
+
|
|
19
|
+
## Non-Goals
|
|
20
|
+
|
|
21
|
+
- Changing the HTML TOC markup shape (`<nav class="toc">` / nested `<ul>`).
|
|
22
|
+
- Adding separate `--toc-min` / `--toc-max` flags.
|
|
23
|
+
- Emitting HTML, JSON, or terminal-styled TOC from `-t toc`.
|
|
24
|
+
- Auto-inserting a TOC into documents that have no marker when using `-t html`.
|
|
25
|
+
|
|
26
|
+
## Behavior
|
|
27
|
+
|
|
28
|
+
### Output shape
|
|
29
|
+
|
|
30
|
+
Given:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
# Introduction
|
|
34
|
+
## Getting Started
|
|
35
|
+
### Installation
|
|
36
|
+
#### Too Deep
|
|
37
|
+
## Configuration
|
|
38
|
+
# API
|
|
39
|
+
{: .no_toc}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
With defaults (`1,3`), `-t toc` produces:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
- [Introduction](#introduction)
|
|
46
|
+
- [Getting Started](#getting-started)
|
|
47
|
+
- [Installation](#installation)
|
|
48
|
+
- [Configuration](#configuration)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Notes:
|
|
52
|
+
|
|
53
|
+
- `#### Too Deep` omitted (above max).
|
|
54
|
+
- `# API` omitted (`.no_toc`).
|
|
55
|
+
- Links use `[Title](#id)` where `id` is generated with the active `--id-format`, or taken from a manual heading ID when present.
|
|
56
|
+
- Nesting is relative to the filtered min level: the shallowest included level is flush (`- `); each deeper included level adds two spaces of indent.
|
|
57
|
+
- No document body, no `<nav>`, no metadata dump.
|
|
58
|
+
- If there are no matching headings, output is empty (no list items). Prefer a single trailing newline only if that matches existing Apex empty-output conventions for other formats; otherwise empty string is fine.
|
|
59
|
+
|
|
60
|
+
### Depth: `--toc-min-max`
|
|
61
|
+
|
|
62
|
+
- CLI: `--toc-min-max=MIN,MAX` and `--toc-min-max MIN,MAX`.
|
|
63
|
+
- Defaults: `toc_min = 1`, `toc_max = 3`.
|
|
64
|
+
- Validation: `1 ≤ min ≤ max ≤ 6`. Invalid values are a CLI error.
|
|
65
|
+
- Optional metadata key with the same semantics: `toc-min-max: 2,4`.
|
|
66
|
+
- Applies to:
|
|
67
|
+
- `-t toc` always (no marker involved).
|
|
68
|
+
- HTML TOC markers (`{{TOC}}`, `<!--TOC-->`, `{:toc}`, etc.) when the marker does **not** specify its own min/max.
|
|
69
|
+
- Marker override examples that win over options defaults:
|
|
70
|
+
- `{{TOC:2-5}}`
|
|
71
|
+
- `<!--TOC max5 min2-->`
|
|
72
|
+
- `{:toc max=5}` (and existing IAL/marker variants already supported)
|
|
73
|
+
|
|
74
|
+
**Default change for HTML markers:** markers with no explicit range currently behave as 1–6. After this change they use option defaults (1–3 unless `--toc-min-max` / metadata overrides). Explicit marker ranges are unchanged. This is intentional and should be noted in docs/changelog as a behavior change for unspecified markers.
|
|
75
|
+
|
|
76
|
+
## Architecture
|
|
77
|
+
|
|
78
|
+
### Approach
|
|
79
|
+
|
|
80
|
+
Early-exit output format + shared heading collection (Approach A).
|
|
81
|
+
|
|
82
|
+
1. Parse markdown and run the same AST prep used for other non-HTML early exits (filters, IAL, manual header IDs).
|
|
83
|
+
2. When `output_format == APEX_OUTPUT_TOC`, collect headings and emit Markdown TOC; return without HTML/terminal/man rendering.
|
|
84
|
+
3. Refactor `src/extensions/toc.c` so HTML marker TOC and Markdown TOC share collection / ID assignment / `no_toc` filtering.
|
|
85
|
+
|
|
86
|
+
### Options / API surface
|
|
87
|
+
|
|
88
|
+
| Piece | Change |
|
|
89
|
+
|-------|--------|
|
|
90
|
+
| `apex_output_format_t` | Add `APEX_OUTPUT_TOC` |
|
|
91
|
+
| `apex_options` | Add `toc_min`, `toc_max` (defaults 1, 3) |
|
|
92
|
+
| CLI (`cli/main.c`) | `-t toc`, `--toc-min-max`; help text |
|
|
93
|
+
| Metadata | Parse `toc-min-max` into options when present |
|
|
94
|
+
| `toc.h` / `toc.c` | Public Markdown TOC helper; thread default min/max into `apex_process_toc` |
|
|
95
|
+
| Tests | Defaults, flag, `no_toc`, id-format, marker override, empty doc |
|
|
96
|
+
| Man page / wiki | Document `-t toc` and `--toc-min-max` |
|
|
97
|
+
|
|
98
|
+
### Suggested public helpers
|
|
99
|
+
|
|
100
|
+
```c
|
|
101
|
+
/* Emit nested Markdown list of headings in [min,max], excluding .no_toc */
|
|
102
|
+
char *apex_generate_toc_markdown(cmark_node *document, int id_format,
|
|
103
|
+
int min_level, int max_level);
|
|
104
|
+
|
|
105
|
+
/* Existing HTML marker processor, extended to accept defaults when
|
|
106
|
+
* the marker does not specify min/max */
|
|
107
|
+
char *apex_process_toc(const char *html, cmark_node *document, int id_format,
|
|
108
|
+
int default_min, int default_max);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Exact signature may vary slightly for ABI/call-site convenience, but callers in `src/apex.c` must pass `options->toc_min` / `options->toc_max`.
|
|
112
|
+
|
|
113
|
+
### Nesting rules
|
|
114
|
+
|
|
115
|
+
Match current HTML TOC nesting semantics relative to the filtered range:
|
|
116
|
+
|
|
117
|
+
- Skip headings outside `[min_level, max_level]`.
|
|
118
|
+
- Indent depth for an included heading is `(level - min_level)` (two spaces per step).
|
|
119
|
+
- Closing / nesting of list levels follows the same open/close pattern as `generate_toc_html` so Markdown and HTML stay structurally aligned.
|
|
120
|
+
|
|
121
|
+
### ID consistency
|
|
122
|
+
|
|
123
|
+
- Prefer an existing manual ID on the heading (`user_data` / IAL / `{#id}`) when present.
|
|
124
|
+
- Otherwise call `apex_generate_header_id(text, id_format)`.
|
|
125
|
+
- `-t toc` must use the same ID rules as HTML header ID injection so links resolve when the same document is rendered to HTML with the same `--id-format`.
|
|
126
|
+
|
|
127
|
+
## Pipeline placement
|
|
128
|
+
|
|
129
|
+
In `apex_markdown_to_html()` (name retained historically), add an early return beside the markdown / JSON-filtered / terminal / man branches—after IAL and manual header ID processing, before HTML render.
|
|
130
|
+
|
|
131
|
+
Do not run HTML postprocessors (pretty HTML, image captions, etc.) for `-t toc`.
|
|
132
|
+
|
|
133
|
+
## Testing
|
|
134
|
+
|
|
135
|
+
Add coverage for:
|
|
136
|
+
|
|
137
|
+
1. Default `-t toc` includes levels 1–3 only.
|
|
138
|
+
2. `--toc-min-max=2,4` filters correctly.
|
|
139
|
+
3. `.no_toc` headings excluded.
|
|
140
|
+
4. `--id-format gfm|mmd|kramdown` changes href slugs as expected.
|
|
141
|
+
5. Manual `{#custom-id}` appears in the link target.
|
|
142
|
+
6. HTML marker with no range uses option defaults (1,3 or overridden flag).
|
|
143
|
+
7. HTML marker with explicit range overrides option defaults.
|
|
144
|
+
8. Document with no headings / no matching levels yields empty (or newline-only) output.
|
|
145
|
+
9. Invalid `--toc-min-max` rejected by CLI.
|
|
146
|
+
|
|
147
|
+
## Documentation
|
|
148
|
+
|
|
149
|
+
- Man page (`man/apex.1.md`): add `toc` to `-t` list; document `--toc-min-max`.
|
|
150
|
+
- Wiki: Command-Line-Options (and any TOC-related page) updated similarly.
|
|
151
|
+
- Changelog via usual `@new` / `@changed` labels when committing the feature.
|
|
152
|
+
|
|
153
|
+
## Open decisions (resolved)
|
|
154
|
+
|
|
155
|
+
| Question | Decision |
|
|
156
|
+
|----------|----------|
|
|
157
|
+
| Default depth | `#`–`###` (1,3) |
|
|
158
|
+
| Depth flag shape | Single `--toc-min-max=MIN,MAX` |
|
|
159
|
+
| Flag scope | Both `-t toc` and HTML markers; marker can override |
|
|
160
|
+
| `.no_toc` | Excluded |
|
|
161
|
+
| Implementation approach | Early-exit format + shared TOC builder |
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Bear Image Attribute Comments
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Interpret Bear-style JSON metadata comments following Markdown images or
|
|
6
|
+
reference definitions and apply supported values as HTML image attributes.
|
|
7
|
+
|
|
8
|
+
Input:
|
|
9
|
+
|
|
10
|
+
```markdown
|
|
11
|
+
<!-- {"width":259} -->
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Unsafe HTML output:
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<p><img src="emperor-1.jpg" alt="" width="259"><!-- {"width":259} --></p>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The metadata comment remains part of the document. Existing safe-HTML
|
|
21
|
+
behavior is unchanged.
|
|
22
|
+
|
|
23
|
+
## Supported syntax
|
|
24
|
+
|
|
25
|
+
A metadata comment may follow any of these forms:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
<!-- {"width":259} -->
|
|
29
|
+
![alt][id]<!-- {"width":259} -->
|
|
30
|
+
[id]: url <!-- {"width":259} -->
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
An inline-image or reference-use comment applies only to that image
|
|
34
|
+
occurrence. A reference-definition comment supplies baseline attributes to
|
|
35
|
+
every image using that definition.
|
|
36
|
+
|
|
37
|
+
Per-use metadata is supported on the explicit `![alt][id]` form. Collapsed
|
|
38
|
+
and shortcut per-use forms are out of scope because they do not provide the
|
|
39
|
+
explicit identifier shown in the requested syntax. Definition metadata still
|
|
40
|
+
applies to every image form that resolves through that definition.
|
|
41
|
+
|
|
42
|
+
A metadata comment qualifies only when:
|
|
43
|
+
|
|
44
|
+
- It is on the same source line as the image or reference definition.
|
|
45
|
+
- It touches the preceding construct or is separated by spaces or tabs.
|
|
46
|
+
- Its trimmed body is a valid JSON object.
|
|
47
|
+
|
|
48
|
+
A comment on a later line is not image metadata. Reference identifiers use
|
|
49
|
+
the same case folding and whitespace normalization as cmark references.
|
|
50
|
+
|
|
51
|
+
## Modes and HTML safety
|
|
52
|
+
|
|
53
|
+
Bear image metadata is recognized in CommonMark, GFM, MultiMarkdown, and
|
|
54
|
+
Unified-family modes.
|
|
55
|
+
|
|
56
|
+
The feature does not weaken HTML safety:
|
|
57
|
+
|
|
58
|
+
- When raw HTML is allowed, the original comment is rendered verbatim.
|
|
59
|
+
- In a safe-HTML configuration, attributes are applied, but the comment is
|
|
60
|
+
handled like other raw HTML and may become `<!-- raw HTML omitted -->`.
|
|
61
|
+
|
|
62
|
+
## Parsing and attribute policy
|
|
63
|
+
|
|
64
|
+
The image-attribute preprocessor recognizes adjacent comments while scanning
|
|
65
|
+
inline images, reference image uses, and reference definitions. It parses
|
|
66
|
+
the JSON without changing the rendered comment.
|
|
67
|
+
|
|
68
|
+
Comments after inline images and reference uses remain in place in the
|
|
69
|
+
Markdown passed to cmark. A definition comment must be detached from the
|
|
70
|
+
definition internally so cmark can parse the reference, then emitted
|
|
71
|
+
byte-for-byte at the same source position. It appears once in rendered
|
|
72
|
+
output; it is not repeated for every reference use.
|
|
73
|
+
|
|
74
|
+
Only flat JSON objects are accepted. The allowlist is `width`, `height`,
|
|
75
|
+
`style`, `class`, `id`, `rel`, and `title`, matching the user-facing image
|
|
76
|
+
attributes recognized by the existing IAL/MultiMarkdown path. Internal Apex
|
|
77
|
+
marker attributes, `data-*` attributes, event-handler attributes, and all
|
|
78
|
+
other keys are ignored. JSON arrays, nested objects, booleans, and null
|
|
79
|
+
values are not converted to attributes.
|
|
80
|
+
|
|
81
|
+
`width` and `height` accept JSON numbers or strings. The other allowed keys
|
|
82
|
+
accept strings only. Existing image conversion behavior remains
|
|
83
|
+
authoritative; for example:
|
|
84
|
+
|
|
85
|
+
- `{"width":259}` becomes `width="259"`.
|
|
86
|
+
- `{"width":"300px"}` becomes `width="300"`.
|
|
87
|
+
- `{"width":"50%"}` becomes `style="width: 50%"`.
|
|
88
|
+
|
|
89
|
+
Attribute names and values must be safely encoded before HTML rendering. A
|
|
90
|
+
malformed payload applies no attributes and leaves the comment untouched.
|
|
91
|
+
|
|
92
|
+
## Data flow
|
|
93
|
+
|
|
94
|
+
1. `apex_preprocess_image_attributes()` detects inline images, reference
|
|
95
|
+
image uses, and reference definitions.
|
|
96
|
+
2. After processing existing attributes, it skips spaces and tabs and checks
|
|
97
|
+
for a complete HTML comment.
|
|
98
|
+
3. If the trimmed body is a valid JSON object, allowed entries become an
|
|
99
|
+
`apex_attributes` value.
|
|
100
|
+
4. Inline-image attributes merge into that image's indexed attribute entry.
|
|
101
|
+
5. Definition attributes merge into the reference-name entry used for all
|
|
102
|
+
instances.
|
|
103
|
+
6. A reference use with local metadata is expanded through the existing
|
|
104
|
+
per-occurrence inline-image path. It inherits definition attributes, then
|
|
105
|
+
merges its local attributes.
|
|
106
|
+
7. Image-use comments remain untouched. Definition comments are detached
|
|
107
|
+
from reference syntax and re-emitted once so cmark does not consume them.
|
|
108
|
+
8. `apex_apply_image_attributes()` attaches the merged attributes to each
|
|
109
|
+
image node, and the existing renderer emits them on `<img>`.
|
|
110
|
+
|
|
111
|
+
## Merge precedence
|
|
112
|
+
|
|
113
|
+
Reference-definition attributes form the baseline for every use. Attributes
|
|
114
|
+
on a specific reference image override the definition for that occurrence
|
|
115
|
+
only. Other occurrences retain the definition value.
|
|
116
|
+
|
|
117
|
+
Within each construct, source order determines precedence. When a key
|
|
118
|
+
appears in standard image attributes, a trailing IAL, and then Bear
|
|
119
|
+
metadata, the Bear value wins. Unrelated attributes are merged.
|
|
120
|
+
|
|
121
|
+
This follows existing behavior for successively merged image attribute
|
|
122
|
+
sources and makes adjacent Bear metadata authoritative for Bear exports.
|
|
123
|
+
|
|
124
|
+
## Error handling
|
|
125
|
+
|
|
126
|
+
Recognition is fail-closed:
|
|
127
|
+
|
|
128
|
+
- Invalid or truncated JSON applies nothing.
|
|
129
|
+
- A non-object JSON value applies nothing.
|
|
130
|
+
- Unsupported keys or value types are ignored individually.
|
|
131
|
+
- A comment that is not adjacent on the same line applies nothing.
|
|
132
|
+
- An unresolved reference-use comment applies nothing to other images.
|
|
133
|
+
- Failure never removes, normalizes, or rewrites the comment.
|
|
134
|
+
|
|
135
|
+
No conversion error is surfaced because the syntax is optional metadata in
|
|
136
|
+
an ordinary HTML comment.
|
|
137
|
+
|
|
138
|
+
## Implementation boundaries
|
|
139
|
+
|
|
140
|
+
The preferred implementation extends the existing image-attribute
|
|
141
|
+
preprocessing and application pipeline in `src/extensions/ial.c`. It should
|
|
142
|
+
not add another renderer-specific attribute system or modify vendored
|
|
143
|
+
cmark-gfm parsing.
|
|
144
|
+
|
|
145
|
+
Reference-definition comments should reuse the existing reference-name entry
|
|
146
|
+
and URL-based application path. Per-use reference comments should reuse the
|
|
147
|
+
existing second-pass expansion of attribute-bearing reference images so each
|
|
148
|
+
occurrence receives an index and can override definition attributes without
|
|
149
|
+
affecting sibling uses.
|
|
150
|
+
|
|
151
|
+
Mode gating in `src/apex.c` must invoke image-attribute preprocessing for
|
|
152
|
+
CommonMark and GFM as well as the already supported modes. Each mode keeps
|
|
153
|
+
its existing raw-HTML safety options.
|
|
154
|
+
|
|
155
|
+
Any small JSON helper should be private to the image-attribute extension and
|
|
156
|
+
cover only the flat object subset required here. No new public API is needed.
|
|
157
|
+
|
|
158
|
+
## Tests
|
|
159
|
+
|
|
160
|
+
Add focused conversion tests covering:
|
|
161
|
+
|
|
162
|
+
- Numeric width (`259`) produces `width="259"`.
|
|
163
|
+
- Width and height are both applied.
|
|
164
|
+
- String pixel and percentage values use existing conversion rules.
|
|
165
|
+
- Spaces or tabs between image and comment are accepted.
|
|
166
|
+
- The original comment is preserved when unsafe HTML is enabled.
|
|
167
|
+
- CommonMark safe mode applies attributes and retains raw-HTML omission.
|
|
168
|
+
- Existing and Bear attributes merge, with Bear winning conflicts.
|
|
169
|
+
- Definition metadata applies to every reference image using that definition.
|
|
170
|
+
- Per-use metadata applies only to the explicit `![alt][id]` occurrence.
|
|
171
|
+
- Per-use metadata overrides definition metadata without changing siblings.
|
|
172
|
+
- A definition comment is rendered once, not once per image occurrence.
|
|
173
|
+
- Reference matching follows cmark case and whitespace normalization.
|
|
174
|
+
- Unresolved or link-only references do not receive image attributes.
|
|
175
|
+
- Unknown, internal, and event-handler keys are ignored.
|
|
176
|
+
- Attribute-breaking JSON strings cannot inject HTML.
|
|
177
|
+
- Malformed JSON, nested values, and non-object payloads apply nothing.
|
|
178
|
+
- A comment on the following line does not apply to the image.
|
|
179
|
+
- Ordinary adjacent HTML comments remain unchanged.
|
|
180
|
+
- Existing reference titles, IAL/MultiMarkdown attributes, and image
|
|
181
|
+
expansion behavior do not regress.
|
|
182
|
+
|
|
183
|
+
Add a representative fixture under `tests/fixtures/images/` as well as
|
|
184
|
+
unit-level assertions in the existing image attribute test suites.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Apex Node.js npm Package
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Publish `@apexmarkdown/apex` as a Node.js native binding for the Apex C
|
|
6
|
+
library, so JavaScript projects can convert Markdown to HTML with Apex's
|
|
7
|
+
modes and options without installing a separate CLI or system libraries.
|
|
8
|
+
|
|
9
|
+
## Repository and layout
|
|
10
|
+
|
|
11
|
+
Create a new repository at `/Users/ttscoff/Desktop/Code/apex-node`, parallel
|
|
12
|
+
to `apex-ruby`. It is not part of the Apex core tree.
|
|
13
|
+
|
|
14
|
+
Initial layout:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
apex-node/
|
|
18
|
+
package.json # public package @apexmarkdown/apex
|
|
19
|
+
README.md
|
|
20
|
+
LICENSE
|
|
21
|
+
vendor/apex/ # pinned Apex git submodule
|
|
22
|
+
binding/
|
|
23
|
+
CMakeLists.txt
|
|
24
|
+
src/addon.cpp # Node-API entry points
|
|
25
|
+
src/options.cpp # JS object -> apex_options
|
|
26
|
+
src/options.h
|
|
27
|
+
lib/
|
|
28
|
+
index.js # ESM/CJS loader
|
|
29
|
+
index.d.ts # TypeScript declarations
|
|
30
|
+
test/
|
|
31
|
+
scripts/
|
|
32
|
+
build.js
|
|
33
|
+
package-prebuild.js
|
|
34
|
+
.github/workflows/
|
|
35
|
+
ci.yml
|
|
36
|
+
publish-prebuilds.yml
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Platform binaries ship as optional dependencies:
|
|
40
|
+
|
|
41
|
+
- `@apexmarkdown/apex-darwin-arm64`
|
|
42
|
+
- `@apexmarkdown/apex-darwin-x64`
|
|
43
|
+
- `@apexmarkdown/apex-linux-arm64`
|
|
44
|
+
- `@apexmarkdown/apex-linux-x64`
|
|
45
|
+
|
|
46
|
+
Each platform package contains a single `.node` addon for that target.
|
|
47
|
+
|
|
48
|
+
## Architecture
|
|
49
|
+
|
|
50
|
+
CMake builds:
|
|
51
|
+
|
|
52
|
+
1. Vendored `cmark-gfm` from `vendor/apex/vendor/cmark-gfm`
|
|
53
|
+
2. Vendored `libyaml` from `vendor/apex/vendor/libyaml`
|
|
54
|
+
3. The Apex C library from `vendor/apex`
|
|
55
|
+
4. A thin C++ Node-API adapter that links against Apex
|
|
56
|
+
|
|
57
|
+
The addon exposes a small native surface. Ergonomics live in JavaScript and
|
|
58
|
+
TypeScript declarations.
|
|
59
|
+
|
|
60
|
+
Distribution:
|
|
61
|
+
|
|
62
|
+
- Consumers install `@apexmarkdown/apex`.
|
|
63
|
+
- npm installs the matching optional platform package when available.
|
|
64
|
+
- The loader resolves the platform `.node` file at runtime.
|
|
65
|
+
- Unsupported OS/arch combinations throw a clear error naming the detected
|
|
66
|
+
platform. Local compilation is not required for supported targets.
|
|
67
|
+
|
|
68
|
+
Supported Node.js: 20 or newer.
|
|
69
|
+
|
|
70
|
+
Supported first-release platforms: macOS and Linux, x64 and arm64.
|
|
71
|
+
|
|
72
|
+
## JavaScript API
|
|
73
|
+
|
|
74
|
+
ESM and CommonJS are both supported, with bundled TypeScript declarations:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { convert, version } from "@apexmarkdown/apex";
|
|
78
|
+
|
|
79
|
+
const html = convert("# Hello", {
|
|
80
|
+
mode: "gfm",
|
|
81
|
+
unsafe: false,
|
|
82
|
+
generateHeaderIds: true
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Primary surface:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
convert(markdown: string, options?: ApexOptions): string
|
|
90
|
+
version: string
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`convert()` is synchronous. Async worker-thread conversion is out of scope
|
|
94
|
+
for v1.
|
|
95
|
+
|
|
96
|
+
## Options mapping
|
|
97
|
+
|
|
98
|
+
`ApexOptions` exposes every user-facing serializable field from
|
|
99
|
+
`apex_options` in camelCase. Defaults come from
|
|
100
|
+
`apex_options_for_mode(mode)` (or unified defaults when `mode` is omitted).
|
|
101
|
+
Explicit JavaScript properties overlay those defaults.
|
|
102
|
+
|
|
103
|
+
Enum fields use string unions rather than C integers:
|
|
104
|
+
|
|
105
|
+
| JS property | Values |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `mode` | `"commonmark"`, `"gfm"`, `"multimarkdown"`, `"kramdown"`, `"unified"`, `"quarto"` |
|
|
108
|
+
| `outputFormat` | `"html"`, `"json"`, `"jsonFiltered"`, `"markdown"`, `"mmd"`, `"commonmark"`, `"kramdown"`, `"gfm"`, `"terminal"`, `"terminal256"`, `"man"`, `"manHtml"`, `"toc"` |
|
|
109
|
+
| `criticMode` | `"markup"`, `"accept"`, `"reject"` |
|
|
110
|
+
| `idFormat` | `"gfm"`, `"mmd"` |
|
|
111
|
+
| `captionPosition` | `"above"`, `"below"` |
|
|
112
|
+
| `wikilinkSpace` | `"dash"`, `"none"`, `"underscore"`, `"space"` |
|
|
113
|
+
|
|
114
|
+
Array fields accept `string[]`:
|
|
115
|
+
|
|
116
|
+
- `stylesheetPaths`
|
|
117
|
+
- `bibliographyFiles`
|
|
118
|
+
- `scriptTags`
|
|
119
|
+
- `astFilterCommands`
|
|
120
|
+
|
|
121
|
+
Path-like and other string options remain caller-owned for the duration of
|
|
122
|
+
the `convert()` call. The binding copies them into conversion-scoped native
|
|
123
|
+
storage before invoking Apex.
|
|
124
|
+
|
|
125
|
+
### Excluded native-only surfaces
|
|
126
|
+
|
|
127
|
+
These `apex_options` members are not exposed in JavaScript:
|
|
128
|
+
|
|
129
|
+
- `plugin_register` / `pluginRegister`
|
|
130
|
+
- `progress_callback` / `progressCallback`
|
|
131
|
+
- `progress_user_data` / `progressUserData`
|
|
132
|
+
- `cmark_init` / `cmarkInit`
|
|
133
|
+
- `cmark_done` / `cmarkDone`
|
|
134
|
+
- `cmark_user_data` / `cmarkUserData`
|
|
135
|
+
- `toc_entries_out` / `tocEntriesOut`
|
|
136
|
+
- `toc_entries_count_out` / `tocEntriesCountOut`
|
|
137
|
+
|
|
138
|
+
Structured TOC extraction via `apex_markdown_to_toc_entries()` may be added
|
|
139
|
+
later as a separate API; it is not part of v1.
|
|
140
|
+
|
|
141
|
+
## Data flow
|
|
142
|
+
|
|
143
|
+
For each `convert()` call:
|
|
144
|
+
|
|
145
|
+
1. Reject non-string Markdown with `TypeError`.
|
|
146
|
+
2. Validate every supplied option name and type.
|
|
147
|
+
3. Initialize `apex_options` from the selected mode.
|
|
148
|
+
4. Overlay explicit JavaScript options onto that struct.
|
|
149
|
+
5. Copy strings and arrays into conversion-scoped native storage.
|
|
150
|
+
6. Call `apex_markdown_to_html(markdown, len, &options)`.
|
|
151
|
+
7. Copy the returned UTF-8 buffer into a JavaScript string.
|
|
152
|
+
8. Free the Apex buffer with `apex_free_string()`.
|
|
153
|
+
9. Release conversion-scoped native storage.
|
|
154
|
+
|
|
155
|
+
`version` returns `apex_version_string()` as a static JavaScript string.
|
|
156
|
+
|
|
157
|
+
## Error handling
|
|
158
|
+
|
|
159
|
+
| Condition | Behavior |
|
|
160
|
+
| --- | --- |
|
|
161
|
+
| Unknown option name | `TypeError` |
|
|
162
|
+
| Wrong option type | `TypeError` |
|
|
163
|
+
| Invalid enum string | `TypeError` |
|
|
164
|
+
| Non-string Markdown | `TypeError` |
|
|
165
|
+
| Native allocation / conversion failure | `Error` |
|
|
166
|
+
| Unsupported OS / architecture | `Error` naming the detected platform |
|
|
167
|
+
|
|
168
|
+
No silent ignoring of unknown or invalid options.
|
|
169
|
+
|
|
170
|
+
## Build and packaging
|
|
171
|
+
|
|
172
|
+
- CMake is the build system for the native addon and bundled dependencies.
|
|
173
|
+
- `APEX_HAVE_LIBYAML` is enabled so YAML metadata matches the SwiftPM build.
|
|
174
|
+
- Prebuilds are produced in CI for the four supported platforms.
|
|
175
|
+
- The public package lists platform packages as optional dependencies and
|
|
176
|
+
contains no install-time compile step for supported targets.
|
|
177
|
+
- Source builds remain available to maintainers via CMake; they are not the
|
|
178
|
+
primary consumer path.
|
|
179
|
+
|
|
180
|
+
## Testing
|
|
181
|
+
|
|
182
|
+
Automated tests cover:
|
|
183
|
+
|
|
184
|
+
- Default conversion and each mode
|
|
185
|
+
- Representative boolean, string, enum, and array options
|
|
186
|
+
- Unknown option and wrong-type rejection
|
|
187
|
+
- Empty input and UTF-8 content
|
|
188
|
+
- `version` string presence
|
|
189
|
+
- Loader failure messaging when the platform package is missing
|
|
190
|
+
|
|
191
|
+
CI builds and tests each supported platform, then packages the `.node`
|
|
192
|
+
artifact for that target.
|
|
193
|
+
|
|
194
|
+
## Out of scope for v1
|
|
195
|
+
|
|
196
|
+
- WebAssembly / browser builds
|
|
197
|
+
- Windows prebuilds
|
|
198
|
+
- Asynchronous / worker-thread conversion APIs
|
|
199
|
+
- Structured TOC JavaScript API
|
|
200
|
+
- JavaScript bridges for C callbacks (`progress`, `cmark_init` / `cmark_done`,
|
|
201
|
+
plugin registration)
|
|
202
|
+
- Requiring system `cmark-gfm` or `libyaml`
|
|
203
|
+
|
|
204
|
+
## Success criteria
|
|
205
|
+
|
|
206
|
+
- `npm install @apexmarkdown/apex` works on macOS and Linux x64/arm64 with
|
|
207
|
+
no local C toolchain.
|
|
208
|
+
- `convert("# Hi")` returns HTML containing a heading.
|
|
209
|
+
- Mode and option overrides affect output as they do in Apex core.
|
|
210
|
+
- Invalid options throw rather than being ignored.
|
|
211
|
+
- TypeScript consumers get accurate declarations for the public API.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Apex App Settings Reference
|
|
2
|
+
|
|
3
|
+
This document lists all Settings referenced in the app-focused documentation that would need to be implemented in the Apex app.
|
|
4
|
+
|
|
5
|
+
## Settings Structure
|
|
6
|
+
|
|
7
|
+
### General
|
|
8
|
+
|
|
9
|
+
| Setting | Type | Description |
|
|
10
|
+
|---------|------|-------------|
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Processor
|
|
14
|
+
|
|
15
|
+
| Setting | Type | Description |
|
|
16
|
+
|---------|------|-------------|
|
|
17
|
+
| Settings->Processor** | Varies | Configure settings->processor** |
|
|
18
|
+
| Settings->Processor**. | Varies | Configure settings->processor**. |
|
|
19
|
+
| Alpha | Varies | Configure alpha |
|
|
20
|
+
| Autolinks** | Varies | Configure autolinks** |
|
|
21
|
+
| CSL | Varies | Configure csl |
|
|
22
|
+
| Citations** | Varies | Configure citations** |
|
|
23
|
+
| Citations**, | Varies | Configure citations**, |
|
|
24
|
+
| Citations**. | Varies | Configure citations**. |
|
|
25
|
+
| Combine | Varies | Configure combine |
|
|
26
|
+
| Critic | Varies | Configure critic |
|
|
27
|
+
| Fenced | Varies | Configure fenced |
|
|
28
|
+
| Footnotes** | Varies | Configure footnotes** |
|
|
29
|
+
| Generate | Varies | Configure generate |
|
|
30
|
+
| Header | Varies | Configure header |
|
|
31
|
+
| Include | Varies | Configure include |
|
|
32
|
+
| Link | Varies | Configure link |
|
|
33
|
+
| MMD | Varies | Configure mmd |
|
|
34
|
+
| Math | Varies | Configure math |
|
|
35
|
+
| Metadata | Varies | Configure metadata |
|
|
36
|
+
| Mixed | Varies | Configure mixed |
|
|
37
|
+
| Mode**. | Varies | Configure mode**. |
|
|
38
|
+
| Superscript/Subscript**. | Varies | Configure superscript/subscript**. |
|
|
39
|
+
| Suppress | Varies | Configure suppress |
|
|
40
|
+
| Table | Varies | Configure table |
|
|
41
|
+
| Wiki | Varies | Configure wiki |
|
|
42
|
+
|
|
43
|
+
### Output
|
|
44
|
+
|
|
45
|
+
| Setting | Type | Description |
|
|
46
|
+
|---------|------|-------------|
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Menu Items
|
|
53
|
+
|
|
54
|
+
| Menu Item | Location | Description |
|
|
55
|
+
|-----------|---------|-------------|
|
|
56
|
+
| Plugins menu | Main menu | Access plugins menu |
|
|
57
|
+
| Help menu | Main menu | Access help menu |
|
|
58
|
+
| About window | Main menu | Access about window |
|
|
59
|
+
|
|
60
|
+
## Notes
|
|
61
|
+
|
|
62
|
+
- Settings should be organized in a Settings window with the structure: **Settings->Category->Setting Name**
|
|
63
|
+
- Boolean settings (checkboxes/toggles) should have clear on/off states
|
|
64
|
+
- File selection settings should provide a file picker dialog
|
|
65
|
+
- Text input settings should have appropriate validation
|
|
66
|
+
- Settings should be saved per-document or globally (user preference)
|
|
67
|
+
|