markdown-it plugin for colon-based definition lists (<dl>, <dt>, <dd>)
npm install markdown-it-dl-list> ๐ ๆฅๆฌ่ช็ใฏใใกใ โ README-ja.md
A markdown-it plugin that adds support for colon-based definition lists
using , , and .
This plugin enables a simple and readable definition list syntax inspired by
Pandoc and other Markdown variants.
- Colon-based definition list syntax
- Supports , , and
- Multiple definitions per term
- Term-only entries (dt-only)
- Nested definition lists
- Designed to work with standard markdown-it pipelines
๐ VS Code users:
Use the companion extension
DL List Preview (colon-based)
to get proper rendering in the built-in Markdown preview.
``bash`
npm install markdown-it-dl-list
`js
import markdownit from "markdown-it";
import dlList from "markdown-it-dl-list";
const md = markdownit();
md.use(dlList);
const src =
: Term
: Definition line 1
: Definition line 2;
console.log(md.render(src));
`
Output:
`html`
`markdown`
: Term
: Definition
`markdown`
: Term
: First definition
: Second definition
A term without definitions is allowed only when followed by a blank line or EOF:
`markdown
: Term only
Next paragraph.
`
Indented lines following a term are treated as part of the term:
`markdown`
: This is a
multiline term
: This is a
multiline definition
`markdown`
: Outer term
: : Inner term
: Inner definition
: Next definition
For the detailed definition list syntax,
โ Definition List Syntax (unified / remark).
Note that this document describes the syntax only.
Implementation-specific behavior (such as editor preview integration)
is documented in this package.
`ts
type DlListOptions = {
/* Indent (spaces) required for dd lines. Default: 4 /
ddIndent?: number;
/* Require at least one dd unless dt-only is followed by blank line or EOF. Default: true /
requireDd?: boolean;
/* Stop parsing the current dl at the first blank line after items. Default: true /
breakOnBlankLine?: boolean;
};
`
Example:
`js`
md.use(dlList, {
ddIndent: 2,
requireDd: true,
});
* Does not modify Markdown rendering outside definition lists
* Does not change markdown-it default paragraph behavior
* Does not attempt to support every existing definition list syntax variant
- remark-dl-list`
A remark plugin that adds the same colon-based definition list syntax to unified / remark pipelines.
MIT