micromark-extension-definition-list
v2.0.0
Published
micromark extension to support definition lists
Downloads
4,588
Maintainers
Readme
micromark-extension-definition-list
micromark extension to support definition lists.
Compatibility Note
This extension might not work with other extensions.
The plugin's tokenizer needs knowledge about token types that other tokenizers generate to create defList. If you find any extensions not working with this, please create issue.
Feature
- fully support Definition Lists Syntax of php-markdown
- can be integrated with remark / rehype / unified using remark-definition-list (or mdast-util-definition-list)
- shipped with types
Install
Install from npm.
$ npm install micromark-extension-definition-list
Use
import { micromark } from 'micromark';
import { defList, defListHtml } from 'micromark-extension-definition-list';
const markdown = `
Apple
: Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
Orange
: The fruit of an evergreen tree of the genus Citrus.
`;
const output = micromark(markdown, {
extensions: [defList],
htmlExtensions: [defListHtml]
});
Known Issues
dd-like line stops parsing gfm-table
Input:
head
| - |
row1
: row2
Expected HTML:
<table>
<thead>
<tr><th>head</th></tr>
</thead>
<tbody>
<tr><td>row1</td></tr>
<tr><td>: row2</td></tr>
</tbody>
</table>
Actual behavior:
<table>
<thead>
<tr><th>head</th></tr>
</thead>
<tbody>
<tr><td>row1</td></tr>
</tbody>
</table>
<p>: row2</p>
Workaround: Escape colon at the start of line
head
| - |
row1
\: row2
Test in development
For development purpose, you can run tests with debug messages.
$ DEBUG="micromark-extension-definition-list:*" npm run test-dev -- -t <title_pattern>