micromark-extension-dl-list
v0.1.3
Published
A micromark extension that adds colon-based definition list (<dl>, <dt>, <dd>) support with CommonMark-compatible parsing rules.
Maintainers
Readme
micromark-extension-dl-list
A micromark extension that adds colon-based definition list syntax.
This package provides syntax only and is intended to be used with remark or other unified pipelines.
For the detailed definition list syntax,
→ docs/syntax.md.
Installation
npm install micromark-extension-dl-listor with pnpm:
pnpm add micromark-extension-dl-listUsage
With micromark (HTML output)
This package can be used directly with micromark
to parse colon-based definition lists and generate
<dl>, <dt>, and <dd> elements.
import { micromark } from 'micromark'
import { dlList, dlListHtml } from 'micromark-extension-dl-list'
const md = `
: term
: description
: another description
`
const html = micromark(md, {
extensions: [dlList()],
htmlExtensions: [dlListHtml()]
})
console.log(html)Output:
<dl>
<dt>term</dt>
<dd>description</dd>
<dd>another description</dd>
</dl>What this package does
- Adds colon-based definition list syntax to micromark
- Emits tokens for
<dl>,<dt>, and<dd>
What this package does NOT do
- Does not generate mdast nodes
- Does not provide a remark plugin
Related packages
This package is part of the unified-dl-list monorepo:
License
MIT
