@altmd/runtime
v0.1.0
Published
The zero-build alt-markdown CDN runtime (loads the WASM core, upgrades components).
Maintainers
Readme
@altmd/runtime
The zero-build browser runtime for alt-markdown: a strict CommonMark superset that renders charts, diagrams, maths, and other components, and still reads as plain markdown when the runtime is not there.
This package is the small (~15 kB gzipped) script that upgrades a rendered
alt-markdown page in the browser. It registers the alt-* custom elements, so
the static fallbacks already baked into the HTML turn into live charts, diagrams,
and maths. No build step, no server.
Use it from a CDN
Render your document to HTML once with the altmd CLI, host the result, then add
one script tag. The easiest way to get a complete page is altmd render
--standalone doc.alt, which emits a self-contained HTML file with the tag
already wired. To upgrade a page you assemble yourself:
<script type="module">
import { bootstrap } from "https://cdn.jsdelivr.net/npm/@altmd/[email protected]/dist/index.js";
bootstrap();
</script>The graphics libraries (uPlot, KaTeX, Mermaid) load lazily, and only when a document actually uses them, so a page with no charts pays nothing for the chart code.
What it does
- Registers the
alt-*components: callouts, tabs, accordions, columns, charts, maths, diagrams, embeds, and a table of contents. - Renders diagrams in a script-disabled, origin-isolated iframe.
- Leaves plain CommonMark untouched, so the document still reads without the runtime.
Links
- Repository and full documentation: https://github.com/elementmerc/alt-markdown
- Live playground: https://elementmerc.github.io/alt-markdown/
Licence
MIT. See LICENSE.
