Project: micromark/micromark-extension-gfm-strikethrough

Package: micromark-extension-gfm-strikethrough@1.0.4

  1. Dependents: 0
  2. micromark extension to support GFM strikethrough
  1. unified 169
  2. markdown 136
  3. micromark 20
  4. gfm 19
  5. micromark-extension 17
  6. strikethrough 6
  7. delete 3
  8. strike 2
  9. through 2
  10. del 2
  11. deletion 2


Build Coverage Downloads Size Sponsors Backers Chat

micromark extension to support GFM strikethrough.


What is this?

This package contains extensions that add support for strikethrough as enabled by GFM to micromark. Strikethrough on github.com, which this extension matches, can use one (~one~) or two (~~two~~) tildes. The GFM spec strictly prohibits one tilde to be used. That behavior can be used by passing singleTilde: false.

When to use this

These tools are all low-level. In many cases, you want to use remark-gfm with remark instead.

Even when you want to use micromark, you likely want to use micromark-extension-gfm to support all GFM features. That extension includes this extension.

When working with mdast-util-from-markdown, you must combine this package with mdast-util-gfm-strikethrough.


This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with npm:

npm install micromark-extension-gfm-strikethrough

In Deno with esm.sh:

import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@1'

In browsers with esm.sh:

<script type="module">
  import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@1?bundle'


import {micromark} from 'micromark'
import {
} from 'micromark-extension-gfm-strikethrough'

const output = micromark('Some ~strikethrough~.', {
  extensions: [gfmStrikethrough()],
  htmlExtensions: [gfmStrikethroughHtml]



<p>Some <del>strikethrough</del></p>.


This package exports the identifiers gfmStrikethrough and gfmStrikethroughHtml. There is no default export.

The export map supports the endorsed development condition. Run node --conditions development module.js to get instrumented dev code. Without this condition, production code is loaded.


Function that can be called to get a syntax extension for micromark (passed in extensions).


Configuration (optional).


Whether to support strikethrough with a single tilde (boolean, default: true). Single tildes work on github.com but are technically prohibited by GFM.


HTML extension for micromark (passed in htmlExtensions).


When authoring markdown with strikethrough, it’s recommended to stick to two tildes for each run. That makes sure it works in most places.


GFM task list items relate to the <del> element in HTML. See § 4.7.2 The del element in the HTML spec for more info.


GitHub itself does not apply interesting CSS to del elements. It currently (July 2022) does change code in del.

del code {
  text-decoration: inherit;

For the complete actual CSS see sindresorhus/github-markdown-css.


Strikethrough parses like other attention (emphasis, strong), which means that it gets really complex and a BNF grammar cannot do it justice.


This package is fully typed with TypeScript. It exports the additional type Options.


This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. It also works in Deno and modern browsers.


This package is safe.


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