IR-first
Start with Writer.createWriter({ markdown }) and use toIR(), toHTML() or toText(). The document is always available.
Render-only · core bundle
The page loads only writer-core.min.js (~100 kB gzip). No contenteditable, no shadow DOM — just Markdown → IR → formats.
Live lab
Every tab is the same document in another format. Change the theme and watch typography flow into the preview — from the same toCss() that you will serve.
Formats
All formats are produced from the same IR. There is no “HTML renderer” and “PDF renderer” disagreeing about the content.
| Format | Method | Note |
|---|---|---|
| HTML | asHTML() | Sanitized by default. |
| IR | asIR() | Canonical document node. |
| JSON | asJSON({}, true) | Pretty-printed IR. |
| Markdown | asMarkdown() | Normalized source. |
| Text | asText() | Without markup. |
asPDF() | Requires an engine — otherwise NO_PDF_ENGINE. |
asPDF() returns RenderResult with base64 contents. The rest are strings / IR.
<script src="/assets/writer/writer-core.min.js"></script>
<div id="out"></div>
<script>
const html = Writer.WriterRender('# Hello **world**')
.theme('serif-editorial')
.asHTML();
document.querySelector('#out').innerHTML = html;
</script>
Core API
writer-core.min.js exposes everything on window.Writer: createWriter, WriterRender, parse, stringify, providers, themes.
Start with Writer.createWriter({ markdown }) and use toIR(), toHTML() or toText(). The document is always available.
writer.typography.toCss(scope) gives you --wr-* variables. This page's preview applies them scoped.
≈100 kB gzip instead of ≈130 kB. No shadow DOM, no contenteditable, no editor state — ideal for SSR and static pages.
core onlywriter.min.js and add <writer-editor>. The core API stays the same. See the Editor API.See the editor, media manager and commands — or read the full API.