Socket
Socket
Sign inDemoInstall

mdast-util-gfm-strikethrough

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-gfm-strikethrough

mdast extension to parse and serialize GFM strikethrough


Version published
Weekly downloads
3.6M
increased by6.19%
Maintainers
2
Weekly downloads
 
Created

What is mdast-util-gfm-strikethrough?

The `mdast-util-gfm-strikethrough` package is a utility for working with strikethrough text in Markdown Abstract Syntax Trees (MDAST). It provides functionality to parse and serialize strikethrough text according to the GitHub Flavored Markdown (GFM) specification.

What are mdast-util-gfm-strikethrough's main functionalities?

Parse Strikethrough

This feature allows you to parse Markdown text containing strikethrough syntax into an MDAST. The code sample demonstrates how to convert a Markdown string with strikethrough text into an MDAST tree.

const { fromMarkdown } = require('mdast-util-from-markdown');
const { gfmStrikethrough } = require('mdast-util-gfm-strikethrough');

const markdown = 'This is ~~strikethrough~~ text.';
const tree = fromMarkdown(markdown, { extensions: [gfmStrikethrough()] });
console.log(JSON.stringify(tree, null, 2));

Serialize Strikethrough

This feature allows you to serialize an MDAST containing strikethrough nodes back into Markdown text. The code sample demonstrates how to convert an MDAST tree with strikethrough nodes into a Markdown string.

const { toMarkdown } = require('mdast-util-to-markdown');
const { gfmStrikethrough } = require('mdast-util-gfm-strikethrough');

const tree = {
  type: 'root',
  children: [
    {
      type: 'paragraph',
      children: [
        { type: 'text', value: 'This is ' },
        { type: 'delete', children: [{ type: 'text', value: 'strikethrough' }] },
        { type: 'text', value: ' text.' }
      ]
    }
  ]
};

const markdown = toMarkdown(tree, { extensions: [gfmStrikethrough()] });
console.log(markdown);

Other packages similar to mdast-util-gfm-strikethrough

Keywords

FAQs

Package last updated on 09 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc