diff --git a/index.js b/index.js index 8038c7a..79cd02f 100644 --- a/index.js +++ b/index.js @@ -38,11 +38,17 @@ export function gfm(options) { ]) } -/** @type {HtmlExtension} */ -export const gfmHtml = combineHtmlExtensions([ - gfmAutolinkLiteralHtml, - gfmStrikethroughHtml, - gfmTableHtml, - gfmTagfilterHtml, - gfmTaskListItemHtml -]) +/** + * Support to compile GFM to HTML. + * + * @returns {HtmlExtension} + */ +export function gfmHtml() { + return combineHtmlExtensions([ + gfmAutolinkLiteralHtml, + gfmStrikethroughHtml, + gfmTableHtml, + gfmTagfilterHtml, + gfmTaskListItemHtml + ]) +} diff --git a/readme.md b/readme.md index d2e542c..24bfe5f 100644 --- a/readme.md +++ b/readme.md @@ -84,7 +84,7 @@ import {gfm, gfmHtml} from 'micromark-extension-gfm' const output = micromark(fs.readFileSync('example.md'), { allowDangerousHtml: true, extensions: [gfm()], - htmlExtensions: [gfmHtml] + htmlExtensions: [gfmHtml()] }) console.log(output) @@ -130,8 +130,8 @@ There is no default export. Support [GFM][] or markdown on github.com. `gfm` is a function that can be called with options and returns an extension for micromark to parse GFM (can be passed in `extensions`). -`gfmHtml` is an extension for micromark to compile as elements (can be passed in -`htmlExtensions`). +`gfmHtml` is a function that can be called and returns an extension for +micromark to compile as elements (can be passed in `htmlExtensions`). ##### `options` diff --git a/test/index.js b/test/index.js index 7511bf2..b0b990e 100644 --- a/test/index.js +++ b/test/index.js @@ -12,7 +12,7 @@ test('markdown -> html (micromark)', (t) => { allowDangerousHtml: true, allowDangerousProtocol: true, extensions: [gfm({singleTilde: false})], - htmlExtensions: [gfmHtml] + htmlExtensions: [gfmHtml()] }), spec[index].output, spec[index].category + ' (' + index + ')'