@yozora/tokenizer-footnote-reference
TypeScript icon, indicating that this package has built-in type declarations

2.3.9 • Public • Published

@yozora/tokenizer-footnote-reference produce FootnoteReference type nodes. See documentation for details.

Install

  • npm

    npm install --save @yozora/tokenizer-footnote-reference
  • yarn

    yarn add @yozora/tokenizer-footnote-reference

Usage

@yozora/tokenizer-footnote-reference has been integrated into @yozora/parser, so you can use YozoraParser directly.

Basic Usage

@yozora/tokenizer-footnote-reference 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 FootnoteReferenceTokenizer from '@yozora/tokenizer-footnote-reference'

const parser = new DefaultParser()
  .useFallbackTokenizer(new ParagraphTokenizer())
  .useFallbackTokenizer(new TextTokenizer())
  .useTokenizer(new FootnoteReferenceTokenizer())

// parse source markdown content
parser.parse(`
Here is a footnote reference,[^1]
another,[^long note],

[^big footnote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    \`\`\`
    Fenced coding
    \`\`\`

    ## heading

    Add as many paragraphs as you like.
`)

Use within @yozora/parser

import YozoraParser from '@yozora/parser'

const parser = new YozoraParser()

// parse source markdown content
parser.parse(`
Here is a footnote reference,[^1]
another,[^long note],

[^big footnote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    \`\`\`
    Fenced coding
    \`\`\`

    ## heading

    Add as many paragraphs as you like.
`)
import GfmParser from '@yozora/parser-gfm'
import FootnoteReferenceTokenizer from '@yozora/tokenizer-footnote-reference'

const parser = new GfmParser()
parser.useTokenizer(new FootnoteReferenceTokenizer())

// parse source markdown content
parser.parse(`
Here is a footnote reference,[^1]
another,[^long note],

[^big footnote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    \`\`\`
    Fenced coding
    \`\`\`

    ## heading

    Add as many paragraphs as you like.
`)
import GfmExParser from '@yozora/parser-gfm-ex'
import FootnoteReferenceTokenizer from '@yozora/tokenizer-footnote-reference'

const parser = new GfmExParser()
parser.useTokenizer(new FootnoteReferenceTokenizer())

// parse source markdown content
parser.parse(`
Here is a footnote reference,[^1]
another,[^long note],

[^big footnote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    \`\`\`
    Fenced coding
    \`\`\`

    ## heading

    Add as many paragraphs as you like.
`)

Options

Name Type Required Default
name string false "@yozora/tokenizer-footnote-reference"
priority number false TokenizerPriority.ATOMIC
  • 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.

Related

/@yozora/tokenizer-footnote-reference/

    Package Sidebar

    Install

    npm i @yozora/tokenizer-footnote-reference

    Weekly Downloads

    225

    Version

    2.3.9

    License

    MIT

    Unpacked Size

    48.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • lemonclown