@yozora/tokenizer-delete produce Delete type nodes. See documentation for details.
-
npm
npm install --save @yozora/tokenizer-delete
-
yarn
yarn add @yozora/tokenizer-delete
@yozora/tokenizer-delete has been integrated into @yozora/parser /
@yozora/parser-gfm-ex, so you can use YozoraParser
/ GfmExParser
directly.
@yozora/tokenizer-delete cannot be used alone, it needs to be registered in YastParser as a plugin-in before it can be used.
import { DefaultParser } from '@yozora/core-parser'
import ParagraphTokenizer from '@yozora/tokenizer-paragraph'
import TextTokenizer from '@yozora/tokenizer-text'
import DeleteTokenizer from '@yozora/tokenizer-delete'
const parser = new DefaultParser()
.useFallbackTokenizer(new ParagraphTokenizer())
.useFallbackTokenizer(new TextTokenizer())
.useTokenizer(new DeleteTokenizer())
// parse source markdown content
parser.parse(`
This ~~has a
new paragraph~~.
`)
Use within @yozora/parser
import YozoraParser from '@yozora/parser'
const parser = new YozoraParser()
// parse source markdown content
parser.parse(`
This ~~has a
new paragraph~~.
`)
Use with @yozora/parser-gfm
import GfmParser from '@yozora/parser-gfm'
import DeleteTokenizer from '@yozora/tokenizer-delete'
const parser = new GfmParser()
parser.useTokenizer(new DeleteTokenizer())
// parse source markdown content
parser.parse(`
This ~~has a
new paragraph~~.
`)
Use within @yozora/parser-gfm-ex
import GfmExParser from '@yozora/parser-gfm-ex'
const parser = new GfmExParser()
// parse source markdown content
parser.parse(`
This ~~has a
new paragraph~~.
`)
Name | Type | Required | Default |
---|---|---|---|
name |
string |
false |
"@yozora/tokenizer-delete" |
priority |
number |
false |
TokenizerPriority.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 thematch-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.