Skip to content

Commit

Permalink
Change gfmHtml to be a function that returns an extension
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 2, 2021
1 parent bd200a2 commit db32db7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
22 changes: 14 additions & 8 deletions index.js
Expand Up @@ -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
])
}
6 changes: 3 additions & 3 deletions readme.md
Expand Up @@ -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)
Expand Down Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Expand Up @@ -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 + ')'
Expand Down

0 comments on commit db32db7

Please sign in to comment.