{"id":13339494,"url":"https://github.com/syntax-tree/mdast-util-gfm-strikethrough","last_synced_at":"2025-08-12T18:20:58.263Z","repository":{"id":57293483,"uuid":"295158279","full_name":"syntax-tree/mdast-util-gfm-strikethrough","owner":"syntax-tree","description":"mdast extension to parse and serialize GFM strikethrough","archived":false,"fork":false,"pushed_at":"2023-07-10T14:37:09.000Z","size":76,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-02-15T20:47:29.405Z","etag":null,"topics":["delete","gfm","mdast","mdast-util","strikethrough","unist"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntax-tree.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2020-09-13T13:35:03.000Z","updated_at":"2024-02-17T08:47:13.000Z","dependencies_parsed_at":"2024-06-18T16:47:13.167Z","dependency_job_id":"fdec2865-9860-491d-a56b-fb848fb12001","html_url":"https://github.com/syntax-tree/mdast-util-gfm-strikethrough","commit_stats":{"total_commits":60,"total_committers":2,"mean_commits":30.0,"dds":0.01666666666666672,"last_synced_commit":"8c8c836171d1b74242399f82866ef4d74bc20961"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-gfm-strikethrough","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-gfm-strikethrough/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-gfm-strikethrough/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-gfm-strikethrough/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntax-tree","download_url":"https://codeload.github.com/syntax-tree/mdast-util-gfm-strikethrough/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243051850,"owners_count":20228282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delete","gfm","mdast","mdast-util","strikethrough","unist"],"created_at":"2024-07-29T19:20:04.131Z","updated_at":"2025-03-11T14:31:26.320Z","avatar_url":"https://github.com/syntax-tree.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"readme":"# mdast-util-gfm-strikethrough\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[mdast][] extensions to parse and serialize [GFM][] strikethrough.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When to use this](#when-to-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`gfmStrikethroughFromMarkdown()`](#gfmstrikethroughfrommarkdown)\n    *   [`gfmStrikethroughToMarkdown()`](#gfmstrikethroughtomarkdown)\n*   [HTML](#html)\n*   [Syntax](#syntax)\n*   [Syntax tree](#syntax-tree)\n    *   [Nodes](#nodes)\n    *   [Content model](#content-model)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package contains two extensions that add support for GFM strikethrough\nsyntax in markdown to [mdast][].\nThese extensions plug into\n[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing\nstrikethrough in markdown into a syntax tree) and\n[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing\nstrikethrough in syntax trees to markdown).\n\n## When to use this\n\nYou can use these extensions when you are working with\n`mdast-util-from-markdown` and `mdast-util-to-markdown` already.\n\nWhen working with `mdast-util-from-markdown`, you must combine this package\nwith [`micromark-extension-gfm-strikethrough`][extension].\n\nWhen you don’t need a syntax tree, you can use [`micromark`][micromark]\ndirectly with `micromark-extension-gfm-strikethrough`.\n\nWhen you are working with syntax trees and want all of GFM, use\n[`mdast-util-gfm`][mdast-util-gfm] instead.\n\nAll these packages are used [`remark-gfm`][remark-gfm], which\nfocusses on making it easier to transform content by abstracting these\ninternals away.\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][mdast-util-to-hast].\nIf you want a different element, you should configure that utility.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install mdast-util-gfm-strikethrough\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {gfmStrikethroughFromMarkdown, gfmStrikethroughToMarkdown} from 'https://esm.sh/mdast-util-gfm-strikethrough@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {gfmStrikethroughFromMarkdown, gfmStrikethroughToMarkdown} from 'https://esm.sh/mdast-util-gfm-strikethrough@2?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\n*Emphasis*, **importance**, and ~~strikethrough~~.\n```\n\n…and our module `example.js` looks as follows:\n\n```js\nimport fs from 'node:fs/promises'\nimport {gfmStrikethrough} from 'micromark-extension-gfm-strikethrough'\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {gfmStrikethroughFromMarkdown, gfmStrikethroughToMarkdown} from 'mdast-util-gfm-strikethrough'\nimport {toMarkdown} from 'mdast-util-to-markdown'\n\nconst doc = await fs.readFile('example.md')\n\nconst tree = fromMarkdown(doc, {\n  extensions: [gfmStrikethrough()],\n  mdastExtensions: [gfmStrikethroughFromMarkdown()]\n})\n\nconsole.log(tree)\n\nconst out = toMarkdown(tree, {extensions: [gfmStrikethroughToMarkdown()]})\n\nconsole.log(out)\n```\n\nNow, running `node example` yields:\n\n```js\n{\n  type: 'root',\n  children: [\n    {\n      type: 'paragraph',\n      children: [\n        {type: 'emphasis', children: [{type: 'text', value: 'Emphasis'}]},\n        {type: 'text', value: ', '},\n        {type: 'strong', children: [{type: 'text', value: 'importance'}]},\n        {type: 'text', value: ', and '},\n        {type: 'delete', children: [{type: 'text', value: 'strikethrough'}]},\n        {type: 'text', value: '.'}\n      ]\n    }\n  ]\n}\n```\n\n```markdown\n*Emphasis*, **importance**, and ~~strikethrough~~.\n```\n\n## API\n\nThis package exports the identifiers\n[`gfmStrikethroughFromMarkdown`][api-gfm-strikethrough-from-markdown] and\n[`gfmStrikethroughToMarkdown`][api-gfm-strikethrough-to-markdown].\nThere is no default export.\n\n### `gfmStrikethroughFromMarkdown()`\n\nCreate an extension for [`mdast-util-from-markdown`][mdast-util-from-markdown]\nto enable GFM strikethrough in markdown.\n\n###### Returns\n\nExtension for `mdast-util-from-markdown` to enable GFM strikethrough\n([`FromMarkdownExtension`][from-markdown-extension]).\n\n### `gfmStrikethroughToMarkdown()`\n\nCreate an extension for [`mdast-util-to-markdown`][mdast-util-to-markdown] to\nenable GFM strikethrough in markdown.\n\n###### Returns\n\nExtension for `mdast-util-to-markdown` to enable GFM strikethrough\n([`ToMarkdownExtension`][to-markdown-extension]).\n\n## HTML\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][mdast-util-to-hast].\nIf you want a different element, you should configure that utility.\n\n## Syntax\n\nSee [Syntax in `micromark-extension-gfm-strikethrough`][syntax].\n\n## Syntax tree\n\nThe following interfaces are added to **[mdast][]** by this utility.\n\n### Nodes\n\n#### `Delete`\n\n```idl\ninterface Delete \u003c: Parent {\n  type: 'delete'\n  children: [TransparentContent]\n}\n```\n\n**Delete** (**[Parent][dfn-parent]**) represents contents that are no longer\naccurate or no longer relevant.\n\n**Delete** can be used where **[phrasing][dfn-phrasing-content]**\ncontent is expected.\nIts content model is **[transparent][dfn-transparent-content]** content.\n\nFor example, the following markdown:\n\n```markdown\n~~alpha~~\n```\n\nYields:\n\n```js\n{\n  type: 'delete',\n  children: [{type: 'text', value: 'alpha'}]\n}\n```\n\n### Content model\n\n#### `PhrasingContent` (GFM strikethrough)\n\n```idl\ntype PhrasingContentGfm = Delete | PhrasingContent\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt does not export additional types.\n\nThe `Delete` type of the mdast node is exposed from `@types/mdast`.\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`mdast-util-gfm-strikethrough@^2`, compatible with Node.js 16.\n\nThis utility works with `mdast-util-from-markdown` version 2+ and\n`mdast-util-to-markdown` version 2+.\n\n## Related\n\n*   [`remarkjs/remark-gfm`][remark-gfm]\n    — remark plugin to support GFM\n*   [`syntax-tree/mdast-util-gfm`][mdast-util-gfm]\n    — same but all of GFM (autolink literals, footnotes, strikethrough, tables,\n    tasklists)\n*   [`micromark/micromark-extension-gfm-strikethrough`][extension]\n    — micromark extension to parse GFM strikethrough\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-strikethrough/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/mdast-util-gfm-strikethrough/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-strikethrough.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-strikethrough\n\n[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-strikethrough.svg\n\n[downloads]: https://www.npmjs.com/package/mdast-util-gfm-strikethrough\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=mdast-util-gfm-strikethrough\n\n[size]: https://bundlejs.com/?q=mdast-util-gfm-strikethrough\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[gfm]: https://github.github.com/gfm/\n\n[remark-gfm]: https://github.com/remarkjs/remark-gfm\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[dfn-transparent-content]: https://github.com/syntax-tree/mdast#transparentcontent\n\n[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension\n\n[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options\n\n[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm\n\n[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast\n\n[micromark]: https://github.com/micromark/micromark\n\n[extension]: https://github.com/micromark/micromark-extension-gfm-strikethrough\n\n[syntax]: https://github.com/micromark/micromark-extension-gfm-strikethrough#syntax\n\n[dfn-parent]: https://github.com/syntax-tree/mdast#parent\n\n[dfn-phrasing-content]: #phrasingcontent-gfm-strikethrough\n\n[api-gfm-strikethrough-from-markdown]: #gfmstrikethroughfrommarkdown\n\n[api-gfm-strikethrough-to-markdown]: #gfmstrikethroughtomarkdown\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fmdast-util-gfm-strikethrough","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntax-tree%2Fmdast-util-gfm-strikethrough","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fmdast-util-gfm-strikethrough/lists"}