API
Install
npm install markhome
parse(source)
Parses MarkHome text into an AST with rooms, doors, windows, items, notes, and recoverable errors.
renderSvg(ast, options)
Renders a parsed AST to an SVG string.
const svg = renderSvg(ast, {
height: 520,
showGrid: true
});
render(source, options)
Parses source text and renders SVG in one call.
const svg = render(source, {
showGrid: false
});
initialize(options)
Finds MarkHome blocks in the browser and replaces them with SVG diagrams.
import markhome from "markhome";
markhome.initialize({
startOnLoad: true,
selector: ".markhome"
});
L-shaped rooms
The parser exposes L-room data as `room.cutout`, and the SVG renderer draws the room as a polygon.