@kalem-editor/viewer
v1.0.0
Published
Render a Markdown AST to the DOM or to an HTML string (SSR) — read-only viewer
Readme
@kalem-editor/viewer
Render a Markdown AST to the DOM or to an HTML string (SSR) — read-only viewer.
Part of Kalem — a WYSIWYG editor for people who don't know Markdown, that saves Markdown.
npm i @kalem-editor/core @kalem-editor/viewerimport { parse } from '@kalem-editor/core';
import { renderToDOM, renderToString } from '@kalem-editor/viewer';
const ast = parse('# Hello\n\nSome **Markdown**.');
renderToDOM(ast, document.getElementById('app')!); // in the browser
const html = renderToString(ast); // on the serverinnerHTML is never used. Raw HTML in Markdown is escaped by default, and links go through a protocol allowlist.
Documentation, guides and the full API: see the Kalem repository.
License
MIT
