commonmark-to-dom

5.1.0 • Public • Published

Introduction

The mdtodom.js script renders a commonmark.js AST directly into DOM on modern web browsers to make a webpage from a Markdown content.

(License)

Usage

The basic usage of the script is shown below:

import {DOMRenderer} from "./mdtodom.js";

// Assuming commonmark.js has been loaded.
let parser = new window.commonmark.Parser();
let renderer = new DOMRenderer(document);
let child = rendereer.render(parser.parse("*something* in Markdown"));

let container = document.getElementById("container");
container.appendChild(child);

See also

The project home.

Informational references

The Fetch standard by WHATWG.

The Fetch API documentation on MDN.

Package Sidebar

Install

npm i commonmark-to-dom

Weekly Downloads

1

Version

5.1.0

License

MIT

Unpacked Size

38.7 kB

Total Files

11

Last publish

Collaborators

  • kazssym