@yozora/tokenizer-list 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/package.json +6 -6
- package/lib/types/match.d.ts +0 -25
- package/lib/types/parse.d.ts +0 -3
- package/lib/types/tokenizer.d.ts +0 -20
- package/lib/types/types.d.ts +0 -65
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020-
|
|
3
|
+
Copyright (c) 2020-2022 guanghechen (me.guanghechen@gmail.com)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-list",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.js",
|
|
33
|
-
"prebuild": "rimraf lib/
|
|
33
|
+
"prebuild": "rimraf lib/",
|
|
34
34
|
"prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build",
|
|
35
35
|
"test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yozora/ast": "^2.0.
|
|
39
|
-
"@yozora/character": "^2.0.
|
|
40
|
-
"@yozora/core-tokenizer": "^2.0.
|
|
38
|
+
"@yozora/ast": "^2.0.3",
|
|
39
|
+
"@yozora/character": "^2.0.3",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "8cc8f95cfebc8d752bc3272cdd24965f540c130b"
|
|
43
43
|
}
|
package/lib/types/match.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { IMatchBlockHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
-
import type { IThis, IToken, T } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* The following rules define list items:
|
|
5
|
-
* - Basic case. If a sequence of lines Ls constitute a sequence of blocks Bs
|
|
6
|
-
* starting with a non-whitespace character, and M is a list marker of width
|
|
7
|
-
* W followed by 1 ≤ N ≤ 4 spaces, then the result of prepending M and the
|
|
8
|
-
* following spaces to the first line of Ls, and indenting subsequent lines
|
|
9
|
-
* of Ls by W + N spaces, is a list item with Bs as its contents. The type
|
|
10
|
-
* of the list item (bullet or ordered) is determined by the type of its
|
|
11
|
-
* list marker. If the list item is ordered, then it is also assigned a
|
|
12
|
-
* start number, based on the ordered list marker.
|
|
13
|
-
*
|
|
14
|
-
* Exceptions:
|
|
15
|
-
* - When the first list item in a list interrupts a paragraph—that is,
|
|
16
|
-
* when it starts on a line that would otherwise count as paragraph
|
|
17
|
-
* continuation text—then
|
|
18
|
-
* (a) the lines Ls must not begin with a blank line, and
|
|
19
|
-
* (b) if the list item is ordered, the start number must be 1.
|
|
20
|
-
* - If any line is a thematic break then that line is not a list item.
|
|
21
|
-
*
|
|
22
|
-
* @see https://github.com/syntax-tree/mdast#listitem
|
|
23
|
-
* @see https://github.github.com/gfm/#list-items
|
|
24
|
-
*/
|
|
25
|
-
export declare const match: IMatchBlockHookCreator<T, IToken, IThis>;
|
package/lib/types/parse.d.ts
DELETED
package/lib/types/tokenizer.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { NodeType } from '@yozora/ast';
|
|
2
|
-
import type { IBlockTokenizer, IMatchBlockHookCreator, IParseBlockHookCreator } from '@yozora/core-tokenizer';
|
|
3
|
-
import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
|
|
4
|
-
import type { INode, IThis, IToken, ITokenizerProps, T } from './types';
|
|
5
|
-
/**
|
|
6
|
-
* Lexical Analyzer for List.
|
|
7
|
-
*
|
|
8
|
-
* A list is a sequence of one or more list items of the same type.
|
|
9
|
-
* The list items may be separated by any number of blank lines.
|
|
10
|
-
*
|
|
11
|
-
* @see https://github.com/syntax-tree/mdast#list
|
|
12
|
-
* @see https://github.github.com/gfm/#list
|
|
13
|
-
*/
|
|
14
|
-
export declare class ListTokenizer extends BaseBlockTokenizer<T, IToken, INode, IThis> implements IBlockTokenizer<T, IToken, INode, IThis> {
|
|
15
|
-
constructor(props?: ITokenizerProps);
|
|
16
|
-
readonly enableTaskListItem: boolean;
|
|
17
|
-
readonly emptyItemCouldNotInterruptedTypes: ReadonlyArray<NodeType>;
|
|
18
|
-
readonly match: IMatchBlockHookCreator<T, IToken, IThis>;
|
|
19
|
-
readonly parse: IParseBlockHookCreator<T, IToken, INode, IThis>;
|
|
20
|
-
}
|
package/lib/types/types.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { List, ListType, NodeType, TaskStatus } from '@yozora/ast';
|
|
2
|
-
import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, ITokenizer, IYastBlockToken } from '@yozora/core-tokenizer';
|
|
3
|
-
export declare type T = ListType;
|
|
4
|
-
export declare type INode = List;
|
|
5
|
-
export declare const uniqueName = "@yozora/tokenizer-list";
|
|
6
|
-
export interface IToken extends IPartialYastBlockToken<T> {
|
|
7
|
-
/**
|
|
8
|
-
* Is it an ordered list item.
|
|
9
|
-
*/
|
|
10
|
-
ordered: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Marker of bullet list-item, or a delimiter of ordered list-item.
|
|
13
|
-
*/
|
|
14
|
-
marker: number;
|
|
15
|
-
/**
|
|
16
|
-
* Marker type of the list.
|
|
17
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol#attr-type
|
|
18
|
-
*/
|
|
19
|
-
orderType?: '1' | 'a' | 'A' | 'i' | 'I';
|
|
20
|
-
/**
|
|
21
|
-
* Serial number of ordered list-item.
|
|
22
|
-
*/
|
|
23
|
-
order?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Status of a todo task.
|
|
26
|
-
*/
|
|
27
|
-
status?: TaskStatus;
|
|
28
|
-
/**
|
|
29
|
-
* Indent of a list item.
|
|
30
|
-
*/
|
|
31
|
-
indent: number;
|
|
32
|
-
/**
|
|
33
|
-
* list-item 起始的空行数量
|
|
34
|
-
* The number of blank lines at the beginning of a list-item
|
|
35
|
-
*/
|
|
36
|
-
countOfTopBlankLine: number;
|
|
37
|
-
/**
|
|
38
|
-
* Child token nodes.
|
|
39
|
-
*/
|
|
40
|
-
children: IYastBlockToken[];
|
|
41
|
-
}
|
|
42
|
-
export interface IThis extends ITokenizer {
|
|
43
|
-
/**
|
|
44
|
-
* Specify an array of Node types that could not be interrupted
|
|
45
|
-
* by this ITokenizer if the current list-item is empty.
|
|
46
|
-
* @see https://github.github.com/gfm/#example-263
|
|
47
|
-
*/
|
|
48
|
-
readonly emptyItemCouldNotInterruptedTypes: ReadonlyArray<NodeType>;
|
|
49
|
-
/**
|
|
50
|
-
* Should enable task list item (extension).
|
|
51
|
-
*/
|
|
52
|
-
readonly enableTaskListItem: boolean;
|
|
53
|
-
}
|
|
54
|
-
export interface ITokenizerProps extends Partial<IBaseBlockTokenizerProps> {
|
|
55
|
-
/**
|
|
56
|
-
* Specify an array of Node types that could not be interrupted
|
|
57
|
-
* by this ITokenizer if the current list-item is empty.
|
|
58
|
-
* @see https://github.github.com/gfm/#example-263
|
|
59
|
-
*/
|
|
60
|
-
readonly emptyItemCouldNotInterruptedTypes?: NodeType[];
|
|
61
|
-
/**
|
|
62
|
-
* Should enable task list item (extension).
|
|
63
|
-
*/
|
|
64
|
-
readonly enableTaskListItem?: boolean;
|
|
65
|
-
}
|