mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 14:48:34 +01:00
23a86d0efa90ce56c3b6c87736df327688f15dd1
Add new --format mdx option to generate Astro Starlight-compatible
MDX documentation from JSON Schema.
Features:
- New MdxGenerator with Tera templates (mdx_base.md, mdx_macros.md)
- Custom heading IDs using {#anchor} syntax for reliable deep linking
- Starlight Badge components for required/optional/deprecated markers
- MDX escape filter for curly braces in descriptions
- Reuses existing schema preparation from prepare.rs
Changes:
- src/mdx_generator.rs: New MDX generation module
- src/templates/mdx_base.md: Base MDX template with frontmatter
- src/templates/mdx_macros.md: Tera macros for MDX rendering
- src/lib.rs: Add generate_mdx() public API and MdxOptions
- src/main.rs: Add --format argument (html/mdx)
- src/prepare.rs: Fix oneOf variant usage anchors for bare $ref
The MDX output integrates with Starlight's TOC generation via
remark-custom-heading-id plugin and produces valid MDX that passes
mdxlint validation.