@yozora/tokenizer-fenced-block 2.0.1 → 2.0.2
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/README.md +45 -45
- package/lib/types/index.d.ts +97 -4
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<header>
|
|
4
4
|
<h1 align="center">
|
|
5
|
-
<a href="https://github.com/yozorajs/yozora/tree/
|
|
5
|
+
<a href="https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/fenced-block#readme">@yozora/tokenizer-fenced-block</a>
|
|
6
6
|
</h1>
|
|
7
7
|
<div align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/@yozora/tokenizer-fenced-block">
|
|
@@ -66,53 +66,53 @@
|
|
|
66
66
|
|
|
67
67
|
[live-examples]: https://yozora.guanghechen.com/docs/package/tokenizer-fenced-block#live-examples
|
|
68
68
|
[docpage]: https://yozora.guanghechen.com/docs/package/tokenizer-fenced-block
|
|
69
|
-
[homepage]: https://github.com/yozorajs/yozora/tree/
|
|
69
|
+
[homepage]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/fenced-block#readme
|
|
70
70
|
[gfm-spec]: https://github.github.com/gfm
|
|
71
71
|
[mdast-homepage]: https://github.com/syntax-tree/mdast
|
|
72
72
|
|
|
73
|
-
[@yozora/ast]: https://github.com/yozorajs/yozora/tree/
|
|
74
|
-
[@yozora/ast-util]: https://github.com/yozorajs/yozora/tree/
|
|
75
|
-
[@yozora/character]: https://github.com/yozorajs/yozora/tree/
|
|
76
|
-
[@yozora/eslint-config]: https://github.com/yozorajs/yozora/tree/
|
|
77
|
-
[@yozora/core-parser]: https://github.com/yozorajs/yozora/tree/
|
|
78
|
-
[@yozora/core-tokenizer]: https://github.com/yozorajs/yozora/tree/
|
|
79
|
-
[@yozora/invariant]: https://github.com/yozorajs/yozora/tree/
|
|
80
|
-
[@yozora/jest-for-tokenizer]: https://github.com/yozorajs/yozora/tree/
|
|
81
|
-
[@yozora/parser]: https://github.com/yozorajs/yozora/tree/
|
|
82
|
-
[@yozora/parser-gfm]: https://github.com/yozorajs/yozora/tree/
|
|
83
|
-
[@yozora/parser-gfm-ex]: https://github.com/yozorajs/yozora/tree/
|
|
84
|
-
[@yozora/template-tokenizer]: https://github.com/yozorajs/yozora/tree/
|
|
85
|
-
[@yozora/tokenizer-admonition]: https://github.com/yozorajs/yozora/tree/
|
|
86
|
-
[@yozora/tokenizer-autolink]: https://github.com/yozorajs/yozora/tree/
|
|
87
|
-
[@yozora/tokenizer-autolink-extension]: https://github.com/yozorajs/yozora/tree/
|
|
88
|
-
[@yozora/tokenizer-blockquote]: https://github.com/yozorajs/yozora/tree/
|
|
89
|
-
[@yozora/tokenizer-break]: https://github.com/yozorajs/yozora/tree/
|
|
90
|
-
[@yozora/tokenizer-definition]: https://github.com/yozorajs/yozora/tree/
|
|
91
|
-
[@yozora/tokenizer-delete]: https://github.com/yozorajs/yozora/tree/
|
|
92
|
-
[@yozora/tokenizer-ecma-import]: https://github.com/yozorajs/yozora/tree/
|
|
93
|
-
[@yozora/tokenizer-emphasis]: https://github.com/yozorajs/yozora/tree/
|
|
94
|
-
[@yozora/tokenizer-fenced-block]: https://github.com/yozorajs/yozora/tree/
|
|
95
|
-
[@yozora/tokenizer-fenced-code]: https://github.com/yozorajs/yozora/tree/
|
|
96
|
-
[@yozora/tokenizer-footnote]: https://github.com/yozorajs/yozora/tree/
|
|
97
|
-
[@yozora/tokenizer-footnote-definition]: https://github.com/yozorajs/yozora/tree/
|
|
98
|
-
[@yozora/tokenizer-footnote-reference]: https://github.com/yozorajs/yozora/tree/
|
|
99
|
-
[@yozora/tokenizer-heading]: https://github.com/yozorajs/yozora/tree/
|
|
100
|
-
[@yozora/tokenizer-html-block]: https://github.com/yozorajs/yozora/tree/
|
|
101
|
-
[@yozora/tokenizer-html-inline]: https://github.com/yozorajs/yozora/tree/
|
|
102
|
-
[@yozora/tokenizer-image]: https://github.com/yozorajs/yozora/tree/
|
|
103
|
-
[@yozora/tokenizer-image-reference]: https://github.com/yozorajs/yozora/tree/
|
|
104
|
-
[@yozora/tokenizer-indented-code]: https://github.com/yozorajs/yozora/tree/
|
|
105
|
-
[@yozora/tokenizer-inline-code]: https://github.com/yozorajs/yozora/tree/
|
|
106
|
-
[@yozora/tokenizer-inline-math]: https://github.com/yozorajs/yozora/tree/
|
|
107
|
-
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/
|
|
108
|
-
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/
|
|
109
|
-
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/
|
|
110
|
-
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/
|
|
111
|
-
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/
|
|
112
|
-
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/
|
|
113
|
-
[@yozora/tokenizer-table]: https://github.com/yozorajs/yozora/tree/
|
|
114
|
-
[@yozora/tokenizer-text]: https://github.com/yozorajs/yozora/tree/
|
|
115
|
-
[@yozora/tokenizer-thematic-break]: https://github.com/yozorajs/yozora/tree/
|
|
73
|
+
[@yozora/ast]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/ast#readme
|
|
74
|
+
[@yozora/ast-util]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/ast-util#readme
|
|
75
|
+
[@yozora/character]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/character#readme
|
|
76
|
+
[@yozora/eslint-config]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/eslint-config#readme
|
|
77
|
+
[@yozora/core-parser]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/core-parser#readme
|
|
78
|
+
[@yozora/core-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/core-tokenizer#readme
|
|
79
|
+
[@yozora/invariant]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/invariant#readme
|
|
80
|
+
[@yozora/jest-for-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/jest-for-tokenizer#readme
|
|
81
|
+
[@yozora/parser]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/parser#readme
|
|
82
|
+
[@yozora/parser-gfm]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/parser-gfm#readme
|
|
83
|
+
[@yozora/parser-gfm-ex]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/parser-gfm-ex#readme
|
|
84
|
+
[@yozora/template-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/template-tokenizer#readme
|
|
85
|
+
[@yozora/tokenizer-admonition]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/admonition#readme
|
|
86
|
+
[@yozora/tokenizer-autolink]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/autolink#readme
|
|
87
|
+
[@yozora/tokenizer-autolink-extension]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/autolink-extension#readme
|
|
88
|
+
[@yozora/tokenizer-blockquote]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/blockquote#readme
|
|
89
|
+
[@yozora/tokenizer-break]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/break#readme
|
|
90
|
+
[@yozora/tokenizer-definition]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/definition#readme
|
|
91
|
+
[@yozora/tokenizer-delete]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/delete#readme
|
|
92
|
+
[@yozora/tokenizer-ecma-import]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/ecma-import#readme
|
|
93
|
+
[@yozora/tokenizer-emphasis]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/emphasis#readme
|
|
94
|
+
[@yozora/tokenizer-fenced-block]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/fenced-block#readme
|
|
95
|
+
[@yozora/tokenizer-fenced-code]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/fenced-code#readme
|
|
96
|
+
[@yozora/tokenizer-footnote]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/footnote#readme
|
|
97
|
+
[@yozora/tokenizer-footnote-definition]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/footnote-definition#readme
|
|
98
|
+
[@yozora/tokenizer-footnote-reference]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/footnote-reference#readme
|
|
99
|
+
[@yozora/tokenizer-heading]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/heading#readme
|
|
100
|
+
[@yozora/tokenizer-html-block]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/html-block#readme
|
|
101
|
+
[@yozora/tokenizer-html-inline]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/html-inline#readme
|
|
102
|
+
[@yozora/tokenizer-image]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/image#readme
|
|
103
|
+
[@yozora/tokenizer-image-reference]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/image-reference#readme
|
|
104
|
+
[@yozora/tokenizer-indented-code]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/indented-code#readme
|
|
105
|
+
[@yozora/tokenizer-inline-code]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/inline-code#readme
|
|
106
|
+
[@yozora/tokenizer-inline-math]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/inline-math#readme
|
|
107
|
+
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/link#readme
|
|
108
|
+
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/link-reference#readme
|
|
109
|
+
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/list#readme
|
|
110
|
+
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/math#readme
|
|
111
|
+
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/paragraph#readme
|
|
112
|
+
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/setext-heading#readme
|
|
113
|
+
[@yozora/tokenizer-table]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/table#readme
|
|
114
|
+
[@yozora/tokenizer-text]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/text#readme
|
|
115
|
+
[@yozora/tokenizer-thematic-break]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/thematic-break#readme
|
|
116
116
|
|
|
117
117
|
[@yozora/react-admonition]: https://github.com/yozorajs/yozora-react/tree/main/packages/admonition#readme
|
|
118
118
|
[@yozora/react-blockquote]: https://github.com/yozorajs/yozora-react/tree/main/packages/blockquote#readme
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { NodeType, Node } from '@yozora/ast';
|
|
2
|
+
import { IPartialYastBlockToken, IPhrasingContentLine, ITokenizer, IBaseBlockTokenizerProps, IMatchBlockPhaseApi, IMatchBlockHook, BaseBlockTokenizer, IBlockTokenizer, IMatchBlockHookCreator } from '@yozora/core-tokenizer';
|
|
3
|
+
import { INodePoint, ICodePoint } from '@yozora/character';
|
|
4
|
+
|
|
5
|
+
declare const FencedBlockType = "fencedBlock";
|
|
6
|
+
declare type FencedBlockType = typeof FencedBlockType;
|
|
7
|
+
interface IToken<T extends NodeType> extends IPartialYastBlockToken<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Line indent of a fenced block.
|
|
10
|
+
*/
|
|
11
|
+
indent: number;
|
|
12
|
+
/**
|
|
13
|
+
* Fence marker.
|
|
14
|
+
*/
|
|
15
|
+
marker: number;
|
|
16
|
+
/**
|
|
17
|
+
* The number of fence marker.
|
|
18
|
+
*/
|
|
19
|
+
markerCount: number;
|
|
20
|
+
/**
|
|
21
|
+
* Lines to construct the contents of a paragraph.
|
|
22
|
+
*/
|
|
23
|
+
lines: IPhrasingContentLine[];
|
|
24
|
+
/**
|
|
25
|
+
* Meta info string
|
|
26
|
+
*/
|
|
27
|
+
infoString: INodePoint[];
|
|
28
|
+
}
|
|
29
|
+
interface IFencedBlockHookContext<T extends NodeType> extends ITokenizer {
|
|
30
|
+
/**
|
|
31
|
+
* Type of special FencedBlock token and FencedBlock node.
|
|
32
|
+
*/
|
|
33
|
+
nodeType: T;
|
|
34
|
+
/**
|
|
35
|
+
* Available fence markers.
|
|
36
|
+
*/
|
|
37
|
+
markers: ICodePoint[];
|
|
38
|
+
/**
|
|
39
|
+
* The minimum amount required
|
|
40
|
+
*/
|
|
41
|
+
markersRequired: number;
|
|
42
|
+
/**
|
|
43
|
+
* Check if the info string is valid.
|
|
44
|
+
* @param infoString
|
|
45
|
+
* @param marker
|
|
46
|
+
* @param countOfMarker
|
|
47
|
+
*/
|
|
48
|
+
checkInfoString?(infoString: Readonly<INodePoint[]>, marker: ICodePoint, countOfMarker: number): boolean;
|
|
49
|
+
}
|
|
50
|
+
interface ITokenizerProps<T extends NodeType> extends Partial<IBaseBlockTokenizerProps> {
|
|
51
|
+
/**
|
|
52
|
+
* ITokenizer name.
|
|
53
|
+
*/
|
|
54
|
+
name: string;
|
|
55
|
+
/**
|
|
56
|
+
* Type of special FencedBlock token and FencedBlock node.
|
|
57
|
+
*/
|
|
58
|
+
nodeType: T;
|
|
59
|
+
/**
|
|
60
|
+
* Available fence markers.
|
|
61
|
+
*/
|
|
62
|
+
markers: ICodePoint[];
|
|
63
|
+
/**
|
|
64
|
+
* The minimum amount required
|
|
65
|
+
*/
|
|
66
|
+
markersRequired: number;
|
|
67
|
+
/**
|
|
68
|
+
* Check if the info string is valid.
|
|
69
|
+
* @param infoString
|
|
70
|
+
* @param marker
|
|
71
|
+
* @param countOfMarker
|
|
72
|
+
*/
|
|
73
|
+
checkInfoString?(infoString: Readonly<INodePoint[]>, marker: ICodePoint, countOfMarker: number): boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare function match<T extends NodeType = NodeType, IThis extends IFencedBlockHookContext<T> = IFencedBlockHookContext<T>>(this: IThis, _api: IMatchBlockPhaseApi): IMatchBlockHook<T, IToken<T>>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Lexical Matcher for FencedBlock.
|
|
80
|
+
*
|
|
81
|
+
* A block fence is a sequence of fence-marker characters (different marker
|
|
82
|
+
* cannot be mixed.) A fenced block begins with a block fence, indented no more
|
|
83
|
+
* than three spaces.
|
|
84
|
+
*
|
|
85
|
+
* @see https://github.com/syntax-tree/mdast#code
|
|
86
|
+
* @see https://github.github.com/gfm/#code-fence
|
|
87
|
+
*/
|
|
88
|
+
declare abstract class FencedBlockTokenizer<T extends NodeType = NodeType, INode extends Node<T> = Node<T>, IThis extends IFencedBlockHookContext<T> = IFencedBlockHookContext<T>> extends BaseBlockTokenizer<T, IToken<T>, INode, any> implements IBlockTokenizer<T, IToken<T>, INode, IThis> {
|
|
89
|
+
protected readonly nodeType: T;
|
|
90
|
+
protected readonly markers: ICodePoint[];
|
|
91
|
+
protected readonly markersRequired: number;
|
|
92
|
+
protected readonly checkInfoString: ITokenizerProps<T>['checkInfoString'];
|
|
93
|
+
constructor(props: ITokenizerProps<T>);
|
|
94
|
+
readonly match: IMatchBlockHookCreator<T, IToken<T>, IThis>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { FencedBlockTokenizer, FencedBlockType, IFencedBlockHookContext, IToken as IFencedBlockToken, ITokenizerProps as IFencedBlockTokenizerProps, FencedBlockTokenizer as default, match as fencedBlockMatch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-fenced-block",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"url": "https://github.com/yozorajs/yozora.git",
|
|
11
11
|
"directory": "tokenizers/fenced-block"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/fenced-block",
|
|
14
14
|
"main": "lib/cjs/index.js",
|
|
15
15
|
"module": "lib/esm/index.js",
|
|
16
16
|
"types": "lib/types/index.d.ts",
|
|
17
17
|
"source": "src/index.ts",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">= 16.0.0"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"lib/",
|
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.js",
|
|
33
33
|
"prebuild": "rimraf lib/ && tsc -p tsconfig.src.json --emitDeclarationOnly",
|
|
34
|
-
"prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build"
|
|
34
|
+
"prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build",
|
|
35
|
+
"test": "echo 'No test yet.'"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@yozora/ast": "^2.0.
|
|
38
|
-
"@yozora/character": "^2.0.
|
|
39
|
-
"@yozora/core-tokenizer": "^2.0.
|
|
38
|
+
"@yozora/ast": "^2.0.2",
|
|
39
|
+
"@yozora/character": "^2.0.2",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.2"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "6911295e9eacfa29563fe93494704190e50625fd"
|
|
42
43
|
}
|