micromark extension to support definition lists.
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.
Install from npm.
$ npm install micromark-extension-definition-list
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]
});
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
For development purpose, you can run tests with debug messages.
$ DEBUG="micromark-extension-definition-list:*" npm run test-dev -- -t <title_pattern>