2.3.12 • Published 4 months ago

@yozora/tokenizer-list v2.3.12

Weekly downloads
21
License
MIT
Repository
github
Last release
4 months ago

@yozora/tokenizer-list produce List (with ListItem as children) type nodes. See documentation for details.

Install

  • npm

    npm install --save @yozora/tokenizer-list
  • yarn

    yarn add @yozora/tokenizer-list

Usage

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

Basic Usage

@yozora/tokenizer-list 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 ListTokenizer from '@yozora/tokenizer-list'

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

// parse source markdown content
parser.parse(`
- a
- b
  - c
  - d
  - e
- f
- g

---

- [ ] This is a TODO item.
- [-] This is a processing TODO item.
- [x] This is a finished TODO item.

---

1. This is an ordered list item

a. This is an another type of ordered list item
`)

Use within @yozora/parser

import YozoraParser from '@yozora/parser'

const parser = new YozoraParser()

// parse source markdown content
parser.parse(`
- a
- b
  - c
  - d
  - e
- f
- g

---

- [ ] This is a TODO item.
- [-] This is a processing TODO item.
- [x] This is a finished TODO item.

---

1. This is an ordered list item

a. This is an another type of ordered list item
`)

Use with @yozora/parser-gfm

import GfmParser from '@yozora/parser-gfm'

const parser = new GfmParser()

// parse source markdown content
parser.parse(`
- a
- b
  - c
  - d
  - e
- f
- g

---

- [ ] This is a TODO item.
- [-] This is a processing TODO item.
- [x] This is a finished TODO item.

---

1. This is an ordered list item

a. This is an another type of ordered list item
`)

Use within @yozora/parser-gfm-ex

import GfmExParser from '@yozora/parser-gfm-ex'

const parser = new GfmExParser()

// parse source markdown content
parser.parse(`
- a
- b
  - c
  - d
  - e
- f
- g

---

- [ ] This is a TODO item.
- [-] This is a processing TODO item.
- [x] This is a finished TODO item.

---

1. This is an ordered list item

a. This is an another type of ordered list item
`)

Options

NameTypeRequiredDefault
namestringfalse"@yozora/tokenizer-list"
prioritynumberfalseTokenizerPriority.CONTAINING_BLOCK
enableTaskListItembooleanfalsefalse
emptyItemCouldNotInterruptedTypesNodeType[]false[ParagraphType]
  • 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.

  • enableTaskListItem: Whether to enable task list item (extension).

  • emptyItemCouldNotInterruptedTypes: Specify an array of Node types that could not be interrupted by this ITokenizer if the current list-item is empty.

    @see https://github.github.com/gfm/#example-263

Related

2.3.12

4 months ago

2.3.11

5 months ago

2.3.10

5 months ago

2.3.9

6 months ago

2.3.8

7 months ago

2.3.7

7 months ago

2.3.6

8 months ago

2.3.4

9 months ago

2.3.5

8 months ago

2.3.3

9 months ago

2.3.2

1 year ago

2.3.1

1 year ago

2.2.0

2 years ago

2.3.0

2 years ago

2.1.5

2 years ago

2.0.6

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.0

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

2 years ago

2.0.4

3 years ago

2.0.2-alpha.0

3 years ago

2.0.1

3 years ago

2.0.5-alpha.0

2 years ago

2.0.0-alpha.3

3 years ago

2.0.0-alpha.0

3 years ago

2.0.0-alpha.1

3 years ago

2.0.0-alpha.2

3 years ago

2.0.0

3 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.2.0-alpha.1

4 years ago

1.2.0-alpha.0

4 years ago

1.1.0

4 years ago

1.1.0-alpha.2

4 years ago

1.1.0-alpha.1

4 years ago

1.1.0-alpha.0

4 years ago

1.0.0

4 years ago

1.0.0-beta.0

4 years ago

1.0.0-alpha.29

4 years ago

1.0.0-alpha.27

4 years ago

1.0.0-alpha.28

4 years ago

1.0.0-alpha.26

4 years ago

1.0.0-alpha.25

4 years ago

1.0.0-alpha.23

4 years ago

1.0.0-alpha.24

4 years ago

1.0.0-alpha.21

4 years ago

1.0.0-alpha.20

4 years ago

1.0.0-alpha.22

4 years ago

1.0.0-alpha.19

4 years ago

1.0.0-alpha.18

4 years ago

1.0.0-alpha.17

4 years ago

1.0.0-alpha.16

4 years ago

1.0.0-alpha.15

4 years ago

1.0.0-alpha.14

4 years ago

1.0.0-alpha.13

4 years ago

1.0.0-alpha.12

4 years ago

1.0.0-alpha.9

4 years ago

1.0.0-alpha.10

4 years ago

1.0.0-alpha.11

4 years ago

1.0.0-alpha.8

4 years ago

1.0.0-alpha.7

4 years ago

1.0.0-alpha.6

4 years ago

1.0.0-alpha.5

4 years ago

1.0.0-alpha.4

4 years ago

1.0.0-alpha.3

4 years ago

1.0.0-alpha.2

4 years ago

1.0.0-alpha.1

4 years ago

1.0.0-alpha.0

4 years ago