carve/ compat

CROSS-FORMAT AST COMPATIBILITY

Carve,
across formats.

Follow source text through foreign parsers, Carve's AST, rendered structure, and back again. Inspect every measured case and every reported loss.

Nine parser targets across Markdown, HTML, Djot, reStructuredText and AsciiDoc. Three Carve engines. Authored expectations. Recorded versions.

Nine external syntax trees mapped to Carvemdast, hast, CommonMark, cmark, Djot, Docutils, Asciidoctor MD4C and Pandoc connect to Carve's AST. Each format is checked through round trips.mdasthastcommonmark.jscmarkdjot.jsDocutilsAsciidoctorMD4CPandocCARVE ASTSTRUCTURE · ATTRIBUTES · ROUND TRIPS
LATEST REPORT

Loading measured results…

Measured at
Reference engineLoading…
Run evidence ↗
—targets measured
—supported comparisons
—loss comparisons
—failed comparisons

CARVE ENGINES

01 / MEASURED COVERAGE

Nine readers. Different boundaries.

Counts describe this fixture set, not a compatibility percentage for an entire format. A passing loss case means the limitation was detected and reported.

02 / CASE EXPLORER

Read the evidence.

Select a cell to inspect its input, mapped AST, exported source, and diagnostics. Empty cells mean the case is outside that target's declared coverage.

supportedAST interchange (I)reported lossfailedoutside coverage
Case coverage by external target. Each measured cell opens detailed evidence.

COMMONMARK IMPORT MEASUREMENT

CommonMark spec examples

Each engine imports the 652 CommonMark 0.31.2 examples. Reference totals use the JavaScript renderer. Separate native totals use each engine’s parser and renderer. The comparator checks its structure against the spec's expected HTML. Measurement only.

Loading CommonMark measurement…

DJOT IMPORT MEASUREMENT

Djot test examples

Each engine imports the HTML examples from the pinned djot.js tests. Reference totals use the JavaScript renderer. Separate native totals use each engine’s parser and renderer. The comparator checks its structure against the expected HTML. Measurement only. Authored heading IDs are not measured.

Loading Djot measurement…

SOURCE ROUNDTRIP MEASUREMENT

Source to HTML and back

Each chain converts a document to HTML and back into the same language. Chains marked without HTML rewrite the source directly and serve as a control. Measurement only.

Open this section to load its evidence.

Generated source, ASTs and positions

Compare native parses of identical Carve source. These observations exercise deeper containers, Unicode, tabs, matched comments, incomplete fences, empty slots and line endings. A fixed seed makes every source reproducible.

Open this section to load its evidence.

03 / THE COMPARISON

More than matching text.

Each supported fixture pairs foreign source with a hand-authored Carve expectation. The suite checks the structure that text matching would miss.

  1. 01

    Parse & map

    The foreign reader builds its tree. An adapter maps it into Carve's published AST schema.

  2. 02

    Check semantics

    Compare nesting, attributes, destinations, list layout, and code whitespace with the authored expectation.

  3. 03

    Render structure

    Compare foreign HTML with Carve's rendered elements and nesting, after declared normalizations.

  4. 04

    Round trip

    Check Carve source, JSON interchange, and exported foreign source by reading each back.

Shared adapters and native checks

JavaScript maps the foreign trees. PHP and Rust verify the mapped ASTs; they do not independently implement those adapters. Import suites below also render each importer’s output through its own engine.

Existing importers

Markdown, HTML, and Djot cases also check Carve's public source importers against the foreign renderer.

Losses are assertions

A loss fixture requires a specific diagnostic code, fidelity, and AST path. It also checks schema validity and retained readable content.

Missing readers fail

The full sweep requires every target. Narrow selections name unmeasured readers; unavailable executables never become silent skips.

04 / LIMITS & FINDINGS

The boundaries stay visible.

These are subset adapters, not a promise that arbitrary foreign trees fit Carve. New claims need new fixtures.

Source coordinates & generated structure

Mapped trees omit foreign source positions and set srcByteLength: 0. Generated section wrappers, heading IDs, and renderer classes are normalized. Authored attributes remain part of the comparison.

List layout & heading levels

Docutils has no Carve list-tightness field; its adapter uses loose lists. Asciidoctor's paragraph-wrapped lists follow the same boundary. reStructuredText heading levels depend on the first appearance of adornment styles; isolated or skipped levels receive export diagnostics.

AsciiDoc inline comparison

Asciidoctor's block model provides structure, and converted HTML provides inline semantics. A separate DocBook conversion is mapped without the HTML adapter and must match the primary tree. Both outputs share Asciidoctor’s parser; this checks two output paths rather than two independent parsers.

Unsupported nodes & fields

Fixtures cover attributes, task state, numbering styles, quote attribution, code metadata, tables, and other nodes outside a target's subset. A loss case passes only when the expected diagnostic is present and readable content survives.

Djot hard-break writer: upstream fix merged

The pinned djot.js 0.3.2 writer throws on hard_break. The adapter uses a tested subset writer for those documents and reports foreign-writer-workaround. Upstream PR #158 merged the native fix on October 2, 2026, including regression tests for wrapping and nested prefixes. This report still measures the pinned 0.3.2 release; the workaround remains until the dependency is upgraded.

Rich tables & Carve source

JavaScript, PHP and Rust preserve multiple bodies, intermediate headers, empty bodies and per-body row headers through positional source metadata. Decimal width assertions stay exact. Inspect the combined table fixture.

Section attributes, block cells and short captions remain declared source losses. Span placeholders can lose header flags. The HAST adapter preserves empty bodies through AST interchange; the measured importer pin drops a leading empty body without a loss diagnostic. The fix is recorded in the closed issue carve-js #2466.

Source-export edge cases

Regression fixtures cover adjacent lists, quotes after code or lists, literal syntax markers, escaped text, duplicate link labels, relative destinations, document titles, and code fences containing delimiter-like lines.

05 / REPRODUCIBLE RESULTS

Take the report with you.

Every report records the engine pin, schema revision and hash, fixture hash, tool versions, and measurement time. Daily runs use locked JavaScript and Python readers and record native reader versions.