The markdown-model package is a JavaScript Markdown parser and renderer.
To parse a Markdown document, use the parseMarkdown function:
import {parseMarkdown} from 'markdown-model/lib/parser.js';
const markdownModel = parseMarkdown(markdownText);
Note: Markdown documents are parsed as GitHub Flavored Markdown (with the exception of HTML blocks).
To render the parsed Markdown in a web browser, use the markdownElements function with the renderElements function from the element-model package:
import {markdownElements} from 'markdown-model/lib/elements.js';
import {renderElements} from 'element-model/lib/elementModel.js';
renderElements(document.body, markdownElements(markdownModel));
To compute the title of the parsed Markdown, use the getMarkdownTitle function:
import {getMarkdownTitle} from 'markdown-model/lib/parser.js';
const markdownTitle = getMarkdownTitle(markdownModel);
This package is developed using javascript-build. It was started using javascript-template as follows:
template-specialize javascript-template/template/ markdown-model/ -k package markdown-model -k name 'Craig A. Hobbs' -k email '[email protected]' -k github 'craigahobbs' -k noapp 1