|
| 1 | +# Add mcpplibs.mwrap.md4c (md4c-m 0.5.3) |
| 2 | + |
| 3 | +## Form |
| 4 | + |
| 5 | +- Source: third-party upstream [mity/md4c](https://github.com/mity/md4c), latest tag `release-0.5.3` |
| 6 | + (`git ls-remote --tags`), MIT. The tarball (`353c346f…059b9e`) is the one compat.md4c 0.5.3 already pins. |
| 7 | +- Form A external mwrap module repository: [mcpplibs/md4c-m](https://github.com/mcpplibs/md4c-m), package |
| 8 | + `mcpplibs.mwrap.md4c`, version `0.5.3` (the upstream version, first release of the identity, no revision |
| 9 | + suffix), tag series `mwrap-${version}`. |
| 10 | +- Implementation ownership: the parser `md4c.c` is compat.md4c's (its configuration and ABI are sufficient). |
| 11 | + Upstream ships a second library, md4c-html (`md4c-html.c`, `entity.c`), which compat.md4c does not build; |
| 12 | + md4c-m vendors those four files byte for byte under `upstream/md4c/src` (checksums in |
| 13 | + `upstream/documents.json`). No implementation is linked twice. |
| 14 | + |
| 15 | +## Modules |
| 16 | + |
| 17 | +- `mcpplibs.mwrap.md4c` — every typedef, enum, enumerator, struct and `md_parse` of `<md4c.h>` by |
| 18 | + `export using`, re-exporting the two below. |
| 19 | +- `mcpplibs.mwrap.md4c.html` — `md_html`. |
| 20 | +- `mcpplibs.mwrap.md4c.macros` — the 23 object-like `MD_FLAG_*` / `MD_DIALECT_*` / `MD_HTML_FLAG_*` macros as |
| 21 | + `inline constexpr unsigned` in `mcpplibs::mwrap::md4c::macros`. md4c has no function-like or control-flow |
| 22 | + macros, so there is no side header; a TU that also includes `<md4c.h>` must set the macros aside to name the |
| 23 | + mapped constants (tested in `tests/header_mix_test.cpp`). |
| 24 | +- `tools/check_exports.py` parses both headers and fails when a public name or flag macro is not exported |
| 25 | + (negative-checked by removing one export). |
| 26 | + |
| 27 | +## Verification |
| 28 | + |
| 29 | +md4c-m CI (Linux GCC 16.1 and LLVM 23.1.3, macOS LLVM, Windows LLVM, all required): build, gtest suites |
| 30 | +(parser callbacks and details, renderer, header mixing, macros), the export audit, and upstream's own |
| 31 | +`test/run-testsuite.py` over all 11 suites through the `md2html` example (CommonMark 0.31.2 spec 652/652, |
| 32 | +extensions, regressions and coverage: 808 examples). Windows needed binary standard streams in md2html (text |
| 33 | +mode rewrote line endings). The templates job scaffolds the default `render` template as an installed |
| 34 | +package (`tools/test_template.py`) and runs it. |
| 35 | + |
| 36 | +Here, with the CI-pinned mcpp 2026.10.26.1 and `MCPP_INDEX_MIRROR=GLOBAL`: |
| 37 | + |
| 38 | +- `bash tests/run_members.sh md4c-render` — the real release archive through the candidate index; the |
| 39 | + consumer parses with callbacks (heading level, table cells, task item) and renders GFM HTML: |
| 40 | + `test result ok`. |
| 41 | +- `python3 tests/mwrap/check_installed_template.py --package mcpplibs.mwrap.md4c@0.5.3` — `mcpp new` from the |
| 42 | + indexed archive, build and run of the unmodified template: "Verified real indexed archive installation and |
| 43 | + unmodified template consumer". |
| 44 | +- `mcpp xpkg parse pkgs/mwrap/md4c.lua` (form A, three platforms) and the lint job's Lua checks. |
| 45 | + |
| 46 | +## Mirror and updates |
| 47 | + |
| 48 | +No `mcpp-res` access in this change, so the descriptor uses the GitHub release URL as a plain string (CN |
| 49 | +users fall back to it); a maintainer can add the GitCode mirror with identical bytes. `extensions.autoupdate` |
| 50 | +follows the repository's own `mwrap-${version}` tags. |
| 51 | + |
| 52 | +## Motivation |
| 53 | + |
| 54 | +openmui's Markdown component (openmui-markdown → openmui-ui-markdown) parses with md4c through this module: |
| 55 | +its document model is checked byte for byte against `md_html` on every upstream example. |
0 commit comments