Socket
Socket
Sign inDemoInstall

micromark-extension-gfm-strikethrough

Package Overview
Dependencies
199
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    micromark-extension-gfm-strikethrough

micromark extension to support GFM strikethrough


Version published
Weekly downloads
2.7M
decreased by-10.12%
Maintainers
1
Install size
5.91 MB
Created
Weekly downloads
 

Package description

What is micromark-extension-gfm-strikethrough?

The micromark-extension-gfm-strikethrough package is an extension for the micromark Markdown parser that adds support for GitHub Flavored Markdown (GFM) strikethrough syntax. This allows users to parse and render strikethrough text in Markdown documents according to the GFM specification.

What are micromark-extension-gfm-strikethrough's main functionalities?

Strikethrough Syntax Parsing

This feature allows the parsing of strikethrough syntax (~~strikethrough~~) in Markdown and converts it to the appropriate HTML <del> tag.

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

const markdown = 'This is ~~strikethrough~~ text.';
const html = micromark(markdown, {
extensions: [gfmStrikethrough()]
});

console.log(html); // Outputs: 'This is <del>strikethrough</del> text.'

Other packages similar to micromark-extension-gfm-strikethrough

Readme

Source

micromark-extension-gfm-strikethrough

Build Coverage Downloads Size Sponsors Backers Chat

micromark extension to support GitHub flavored markdown (GFM) strikethrough (like this). This syntax extension matches either the GFM spec (only two tildes work) or github.com (both one or two tildes, when they match, work).

When to use this

You should probably use micromark-extension-gfm instead, which combines this package with other GFM features. Alternatively, if you don’t want all of GFM, use this package.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install micromark-extension-gfm-strikethrough

Use

import {micromark} from 'micromark'
import {
  gfmStrikethrough,
  gfmStrikethroughHtml
} from 'micromark-extension-gfm-strikethrough'

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

console.log(output)

Yields:

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

API

This package exports the following identifiers: gfmStrikethrough, 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.

gfmStrikethrough(options?)

gfmStrikethroughHtml

Support strikethrough (like this). gfmStrikethrough is a function that can be called with options and returns an extension for micromark to parse strikethrough (can be passed in extensions). gfmStrikethroughHtml is an extension for micromark to compile as <del> elements (can be passed in htmlExtensions).

options
options.singleTilde

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

Contribute

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.

License

MIT © Titus Wormer

Keywords

FAQs

Last updated on 02 Oct 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc