09 / 11
Add Schemd to a Markdown pipeline
Handle only schemd fences and leave every other token to the host parser.
01 / Adapter
Keep the compiler boundary small
Schemd is parser-free. Your host adapter only needs to recognize the fence and compile it:
ts
import { compileSchematic, parseSchematicFence } from '@schemd/core';
export function renderSchemdFence(body: string, info: string) {
const fence = parseSchematicFence(info);
return fence ? compileSchematic(body, fence).svg : undefined;
}
Recognize only the schemd language. Send every other fence back to the host parser. Emit the compiled SVG as trusted HTML on the server; do not run arbitrary HTML through the same path.