micromark-extension-gfm-strikethrough
micromark tokenizer extension for GFM strikethrough syntax
Repository Health
Technical Analysis
micromark-extension-gfm-strikethrough is a low-level tokenizer extension for the micromark markdown parser that teaches it to recognize GitHub Flavored Markdown strikethrough syntax (~~text~~). It operates at the character-tokenization layer, below the syntax-tree layer, and includes both a parsing extension (gfmStrikethrough()) and an optional HTML-compiling extension (gfmStrikethroughHtml()) for direct markdown-to-HTML use.
It is one of the smallest building blocks in the unified/remark/micromark ecosystem, maintained under the micromark GitHub organization by Titus Wormer. Most consumers reach it transitively through micromark-extension-gfm (full GFM) or remark-gfm/mdast-util-gfm-strikethrough for syntax-tree use cases, rather than depending on it directly.
What You Get
gfmStrikethrough(options?)— a micromark syntax extension that tokenizes~~text~~per the GFM specgfmStrikethroughHtml()— an optional HTML-compiler extension that renders strikethrough directly to<del>tags- A
singleTildeoption controlling whether single-tilde strikethrough (~text~) is also recognized - Full TypeScript type definitions and 100%-coverage-enforced test suite
- Zero-dependency-on-mdast design — usable with plain
micromarkwhen no syntax tree is needed
Common Use Cases
- Rendering markdown directly to HTML via
micromark+ this extension, without building a syntax tree, for lightweight markdown-to-HTML conversion - Composing custom micromark-based markdown parsers/renderers that need GFM strikethrough support
- Used transitively by
micromark-extension-gfmand, viamdast-util-gfm-strikethrough, byremark-gfmfor full GitHub Flavored Markdown support
Under The Hood
Architecture The package is a micromark tokenizer extension: it defines character codes and finite-state tokenizer functions that micromark’s core parser calls into when it encounters a tilde (~) character, following the same extension-object protocol (text, resolveAll) used by every other micromark-extension-* package. A companion HTML-compiler extension separately hooks the enter/exit events for the produced tokens to emit <del>/</del>. Tech Stack Pure JavaScript authored with JSDoc types (compiled via tsc --build + type-coverage to a .d.ts), depending only on other micromark-util-* helper packages (chunked, classify-character, resolve-all, symbol, types) and devlop for dev-mode assertions — no unrelated runtime dependencies. Code Quality The test/ directory runs against micromark itself in both development and production conditions (test-api-dev/test-api-prod), with c8 --100 enforcing full coverage as part of the required test script, and fixtures partly generated via create-gfm-fixtures to track the upstream GFM spec. API Design The public surface is two small factory-free extension objects designed to be spread into micromark’s extensions/htmlExtensions arrays, keeping the same minimal-composition convention as the rest of the ecosystem; the singleTilde option is the only configuration surface, kept deliberately narrow to match the GFM spec’s own ambiguity around single-tilde strikethrough.
Used by 2 apps in this directory
AFFiNE
Productivity · Project Management · Note Taking
Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.
KeystoneJS
CMS · Developer Tools
The superpowered headless CMS for developers built with GraphQL and React