Connect toolchains

Compile only canonical schemd fences

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

sheet
12 / 15
rev
v0.6
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:VB "9 V" at (80, 130) #blue [type=voltage-dc]
switch:SB "button" at (300, 130) #amber [type=pushbutton]
load:LP "lamp" at (560, 130) #emerald [type=lamp]

VB.positive -> SB.in #blue [line]
SB.out -> LP.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.