Skip to main content
Version: 3.x.x 🚧

@yozora/tokenizer-delete

Npm VersionNpm DownloadNpm LicenseModule formats: cjs, esmNode.js VersionTested with JestCode Style: prettier

github flavor markdown spec

GFM enables the strikethrough extension, where an additional emphasis type is available.

Strikethrough text is any text wrapped in two tildes (~).

Install

npm install --save @yozora/tokenizer-delete

Usage

tip

@yozora/tokenizer-delete has been integrated into @yozora/parser / @yozora/parser-gfm-ex, so you can use YozoraParser / GfmExParser directly.

import YozoraParser from '@yozora/parser'

const parser = new YozoraParser()

// parse source markdown content
parser.parse(`
This ~~has a

new paragraph~~.
`)

Options

NameTypeRequiredDefault
namestringfalse"@yozora/tokenizer-delete"
prioritynumberfalseTokenizerPriority.CONTAINING_INLINE
  • name: The unique name of the tokenizer, used to bind the token it generates, to determine the tokenizer that should be called in each life cycle of the token in the entire matching / parsing phase.

  • priority: Priority of the tokenizer, determine the order of processing, high priority priority execution. interruptable. In addition, in the match-block stage, a high-priority tokenizer can interrupt the matching process of a low-priority tokenizer.

    Exception: Delimiters of type full are always processed before other type delimiters.

Types

@yozora/tokenizer-delete produce Delete type nodes. See @yozora/ast for full base types.

import type { Parent } from '@yozora/ast'

export const DeleteType = 'delete'
export type DeleteType = typeof DeleteType

/**
* Delete represents contents that are no longer accurate or no longer relevant.
* @see https://github.com/syntax-tree/mdast#delete
* @see https://github.github.com/gfm/#strikethrough-extension-
*/
export type Delete = Parent<DeleteType>

Live Examples

  • Basic.

    #491
      
      
  • As with regular emphasis delimiters, a new paragraph will cause strikethrough parsing to cease.

    #492