30 lines
672 B
JavaScript
30 lines
672 B
JavaScript
/**
|
|
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
|
|
*/
|
|
|
|
/**
|
|
* Create an HTML extension for `micromark` to support GFM task list items when
|
|
* serializing to HTML.
|
|
*
|
|
* @returns {HtmlExtension}
|
|
* Extension for `micromark` that can be passed in `htmlExtensions` to
|
|
* support GFM task list items when serializing to HTML.
|
|
*/
|
|
export function gfmTaskListItemHtml() {
|
|
return {
|
|
enter: {
|
|
taskListCheck() {
|
|
this.tag('<input type="checkbox" disabled="" ')
|
|
}
|
|
},
|
|
exit: {
|
|
taskListCheck() {
|
|
this.tag('/>')
|
|
},
|
|
taskListCheckValueChecked() {
|
|
this.tag('checked="" ')
|
|
}
|
|
}
|
|
}
|
|
}
|