Source model
Reading source back out of the IR, never out of the DOM.
Blasdoc can give you the source of any part of a document — and it never reads it back out of the DOM.
Slicing the original text
The IR preserves source positions, so the exact bytes an author wrote can be sliced back out:
import { sliceSource, sliceChildrenSource } from '@blasdoc/core';
const { document, source } = parseBlasdoc(markdown);
const node = document.children[2];
sliceSource(source, node); // the node, verbatim
sliceChildrenSource(source, node); // just what is between its tagsThis is what a live preview shows: the source the reader wrote, not a re-rendering of it.
Rebuilding from the IR
When there is no original text — a document assembled in code, or one transformed — the source renderer rebuilds it:
import { renderAngularSource } from '@blasdoc/core';
renderAngularSource(node);It preserves all four Angular channels and the order the author wrote them in:
<app-button variant="primary" [disabled]="locked" (clicked)="buy()" [(value)]="q">stays exactly that. A binding is never normalised into an attribute, and an attribute is never promoted to a binding.
Round-tripping Markdown
import { renderMarkdownSource } from '@blasdoc/core';
renderMarkdownSource(document);Markdown is reproduced semantically, not byte for byte: it round-trips
through the IR but normalises marker characters and spacing. * and _ both
mean emphasis, and only one of them comes back.
Why this exists
Because the same representation has to power two things at once: the live Angular preview, and an accurate Angular source rendering. Every design decision in Blasdoc is measured against that. When a change would break the relationship, the change is wrong.