Project: micromark/micromark-extension-gfm-tagfilter

Package: micromark-extension-gfm-tagfilter@1.0.0

  1. Dependents: 1
  2. micromark extension to support GFM tagfilter
  1. unified 173
  2. markdown 139
  3. html 122
  4. micromark 34
  5. gfm 20
  6. micromark-extension 16
  7. filter 5
  8. tagfilter 3
  9. tag 2


Build Coverage Downloads Size Sponsors Backers Chat

micromark extension to support GitHub flavored markdown tag filter. This extension matches the GFM spec and github.com. The tag filter is a rather naïve attempt at XSS protection. It’s much better to use a proper HTML sanitizing algorithm.

When to use this

You should probably use micromark-extension-gfm, which combines this package with other GFM features, instead. If for some weird reason you have to match GHs tagfilter, but not all the other GFM parts, use this package.


This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.


npm install micromark-extension-gfm-tagfilter


import {micromark} from 'micromark'
import {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter'

const output = micromark('XSS! <script>alert(1)</script>', {
  allowDangerousHtml: true,
  htmlExtensions: [gfmTagfilterHtml]



<p>XSS! &lt;script>alert(1)&lt;/script></p>


This package exports the following identifiers: gfmTagfilterHtml. There is no default export.


Support a tag filter (protection against script, plaintext, etc). The export is an extension for the micromark compiler to escape certain tag names (can be passed in htmlExtensions).


See contributing.md in micromark/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.


MIT © Titus Wormer