mdast-util-gfm-strikethrough

mdast extensions to parse and serialize GFM strikethrough syntax

Library
npm
v2.0.0
5stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
30/100Needs Attention
Development Activity24
Maintenance24
Community12
Maturity60
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
70/100Good
Architecture70
Code Quality90
Innovation55
Learning Curve65

mdast-util-gfm-strikethrough is a small syntax-tree extension package in the unified/remark ecosystem that adds GitHub Flavored Markdown strikethrough support (~~text~~) to mdast syntax trees. It exports two extensions: one that plugs into mdast-util-from-markdown to parse strikethrough into a delete node, and one that plugs into mdast-util-to-markdown to serialize that node back into markdown.

It is a low-level building block rather than something most application authors install directly — most consumers get strikethrough support transitively through mdast-util-gfm (all of GFM) or remark-gfm, both of which depend on this package. It is maintained under the syntax-tree organization by Titus Wormer alongside the rest of the unified ecosystem.

What You Get

  • gfmStrikethroughFromMarkdown() — an extension for mdast-util-from-markdown that turns ~~text~~ into a delete mdast node
  • gfmStrikethroughToMarkdown() — an extension for mdast-util-to-markdown that serializes delete nodes back to ~~text~~
  • Full TypeScript types via @types/mdast and a generated index.d.ts
  • 100% test coverage enforced via c8 in CI-style build scripts
  • ESM-only distribution with zero runtime side effects (sideEffects: false)

Common Use Cases

  • Building a custom remark/mdast-based markdown processor that needs GFM strikethrough without pulling in all of GFM
  • Used transitively by mdast-util-gfm and remark-gfm to provide strikethrough support in most remark-based tooling
  • Authoring a markdown-to-markdown or markdown-to-HTML transform pipeline with unified that needs strikethrough round-tripping

Under The Hood

Architecture The package is intentionally minimal — lib/ contains the from-markdown and to-markdown extension objects, and index.js re-exports them. It has no parsing logic of its own for the strikethrough token itself; that lives in the companion micromark-extension-gfm-strikethrough package, which this package must be paired with when working with mdast-util-from-markdown directly. Tech Stack Pure JavaScript/TypeScript (types-only, via JSDoc + tsc --build) with dependencies limited to @types/mdast, mdast-util-from-markdown, and mdast-util-to-markdown — no unrelated dependencies. Tooling includes xo for linting, prettier for formatting, and remark-preset-wooorm for consistent docs across the syntax-tree org’s packages. Code Quality test.js (216 lines) exercises both extensions directly against mdast-util-from-markdown/to-markdown, run in both production and development conditions (test-api-prod/test-api-dev) with c8 --100 enforcing full coverage before every publish. API Design The API is deliberately tiny: two factory-free extension objects designed to be spread directly into the extensions/mdastExtensions arrays of the from-markdown/to-markdown APIs, following the same extension-object convention used across every other mdast-util-gfm-* package, which keeps composition predictable for anyone already using the unified ecosystem.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search