Connect toolchains

Compile only canonical schemd fences

Leave prose parsing to the host and compile bounded schemd blocks with exact diagnostics.

sheet
10 / 13
rev
v0.4
sections
1
compiled
1

01 / MarkdownParse the information string before the body

Hand the information string to parseSchematicFence before touching the body. If it returns undefined, the block is not ours — give it straight back to the host parser. If it succeeds, compile the body and surface SchematicSyntaxError.line, because swallowing a broken example only means shipping it.

const fence = parseSchematicFence(token.info);
if (!fence) return next(token);
return compileSchematic(token.text, { ...fence, mode: 'default' }).svg;
source:V "5 V" at (80, 130) #blue [type=voltage-dc]
protection:F "breaker" at (300, 130) #amber [type=breaker]
load:B "buzzer" at (560, 130) #emerald [type=buzzer]
V.positive -> F.in #blue [line]
F.out -> B.in #emerald [line]
compiled by @schemd/core → shown in the rail

This site compiles every versioned fence in its own test suite, which is what stops a documentation example from being decoration. Each line keeps its own corpus, and newer syntax is never backfilled into an older one.