Quick Start
🚧 Beta Software
markdown-exit v1 is currently in public beta (v1.0.0-beta.*). Breaking changes may occur until a stable v1.0.0 is released.
Installation
v1+ (latest): All new features and may include breaking changes from markdown-it.
npm install markdown-exitpnpm add markdown-exityarn add markdown-exitbun add markdown-exit<script type="module">
import { createMarkdownExit } from 'https://esm.sh/markdown-exit';
const md = createMarkdownExit();
const html = md.render('# markdown-exit');
</script>Legacy Version
v0.x (legacy): Full compatibility with markdown-it usage while adding TypeScript support, bug fixes and performance improvements. (v0 branch)
npm install markdown-exit@legacypnpm add markdown-exit@legacyyarn add markdown-exit@legacybun add markdown-exit@legacy<script type="module">
import { createMarkdownExit } from 'https://esm.sh/markdown-exit@legacy';
const md = createMarkdownExit();
const html = md.render('# markdown-exit');
</script>Usage
Named import (recommended)
Use createMarkdownExit to create an instance:
import { createMarkdownExit } from 'markdown-exit'
// factory helper
const md = createMarkdownExit()
md.render('# markdown-exit')Rendering
Please refer to the Rendering guide for more details on rendering Markdown content.
If you prefer using the MarkdownExit class with new, you can do so as follows:
import { MarkdownExit } from 'markdown-exit'
// with the `new` keyword
const md = new MarkdownExit()Default import (with callable constructor support) is retained for markdown-it compatibility, but it may have drawbacks in module interop and tree-shaking. We do not recommend using it in modern codebases.
import MarkdownExit from 'markdown-exit'
// callable function
const md = MarkdownExit()
// OR with the `new` keyword
const md = new MarkdownExit()