@yozora/tokenizer-fenced-block 2.0.0-alpha.0 → 2.0.0
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 +0 -2
- package/lib/cjs/index.js +3 -3
- package/lib/esm/index.js +4 -4
- package/lib/types/index.d.ts +1 -1
- package/lib/types/match.d.ts +2 -2
- package/lib/types/tokenizer.d.ts +2 -2
- package/lib/types/types.d.ts +4 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -107,7 +107,6 @@
|
|
|
107
107
|
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link#readme
|
|
108
108
|
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link-reference#readme
|
|
109
109
|
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list#readme
|
|
110
|
-
[@yozora/tokenizer-list-item]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list-item#readme
|
|
111
110
|
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/main/tokenizers/math#readme
|
|
112
111
|
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/main/tokenizers/paragraph#readme
|
|
113
112
|
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/main/tokenizers/setext-heading#readme
|
|
@@ -167,7 +166,6 @@
|
|
|
167
166
|
[doc-@yozora/tokenizer-definition]: https://yozora.guanghechen.com/docs/package/tokenizer-definition
|
|
168
167
|
[doc-@yozora/tokenizer-link-reference]: https://yozora.guanghechen.com/docs/package/tokenizer-link-reference
|
|
169
168
|
[doc-@yozora/tokenizer-list]: https://yozora.guanghechen.com/docs/package/tokenizer-list
|
|
170
|
-
[doc-@yozora/tokenizer-list-item]: https://yozora.guanghechen.com/docs/package/tokenizer-list-item
|
|
171
169
|
[doc-@yozora/tokenizer-math]: https://yozora.guanghechen.com/docs/package/tokenizer-math
|
|
172
170
|
[doc-@yozora/tokenizer-paragraph]: https://yozora.guanghechen.com/docs/package/tokenizer-paragraph
|
|
173
171
|
[doc-@yozora/tokenizer-setext-heading]: https://yozora.guanghechen.com/docs/package/tokenizer-setext-heading
|
package/lib/cjs/index.js
CHANGED
|
@@ -36,8 +36,8 @@ function match(_api) {
|
|
|
36
36
|
const token = {
|
|
37
37
|
nodeType: nodeType,
|
|
38
38
|
position: {
|
|
39
|
-
start: coreTokenizer.
|
|
40
|
-
end: coreTokenizer.
|
|
39
|
+
start: coreTokenizer.calcStartPoint(nodePoints, startIndex),
|
|
40
|
+
end: coreTokenizer.calcEndPoint(nodePoints, nextIndex - 1),
|
|
41
41
|
},
|
|
42
42
|
indent: firstNonWhitespaceIndex - startIndex,
|
|
43
43
|
marker: marker,
|
|
@@ -106,4 +106,4 @@ const FencedBlockType = 'fencedBlock';
|
|
|
106
106
|
exports.FencedBlockTokenizer = FencedBlockTokenizer;
|
|
107
107
|
exports.FencedBlockType = FencedBlockType;
|
|
108
108
|
exports["default"] = FencedBlockTokenizer;
|
|
109
|
-
exports.
|
|
109
|
+
exports.fencedBlockMatch = match;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { calcTrimBoundaryOfCodePoints, isSpaceCharacter } from '@yozora/character';
|
|
2
|
-
import { eatOptionalCharacters,
|
|
2
|
+
import { eatOptionalCharacters, calcStartPoint, calcEndPoint, BaseBlockTokenizer, TokenizerPriority } from '@yozora/core-tokenizer';
|
|
3
3
|
|
|
4
4
|
function match(_api) {
|
|
5
5
|
const { nodeType, markers, markersRequired, checkInfoString } = this;
|
|
@@ -32,8 +32,8 @@ function match(_api) {
|
|
|
32
32
|
const token = {
|
|
33
33
|
nodeType: nodeType,
|
|
34
34
|
position: {
|
|
35
|
-
start:
|
|
36
|
-
end:
|
|
35
|
+
start: calcStartPoint(nodePoints, startIndex),
|
|
36
|
+
end: calcEndPoint(nodePoints, nextIndex - 1),
|
|
37
37
|
},
|
|
38
38
|
indent: firstNonWhitespaceIndex - startIndex,
|
|
39
39
|
marker: marker,
|
|
@@ -99,4 +99,4 @@ class FencedBlockTokenizer extends BaseBlockTokenizer {
|
|
|
99
99
|
|
|
100
100
|
const FencedBlockType = 'fencedBlock';
|
|
101
101
|
|
|
102
|
-
export { FencedBlockTokenizer, FencedBlockType, FencedBlockTokenizer as default, match as
|
|
102
|
+
export { FencedBlockTokenizer, FencedBlockType, FencedBlockTokenizer as default, match as fencedBlockMatch };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { match as
|
|
1
|
+
export { match as fencedBlockMatch } from './match';
|
|
2
2
|
export { FencedBlockTokenizer, FencedBlockTokenizer as default } from './tokenizer';
|
|
3
3
|
export { FencedBlockType } from './types';
|
|
4
4
|
export type { IFencedBlockHookContext, IToken as IFencedBlockToken, ITokenizerProps as IFencedBlockTokenizerProps, } from './types';
|
package/lib/types/match.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NodeType } from '@yozora/ast';
|
|
2
2
|
import type { IMatchBlockHook, IMatchBlockPhaseApi } from '@yozora/core-tokenizer';
|
|
3
3
|
import type { IFencedBlockHookContext, IToken } from './types';
|
|
4
|
-
export declare function match<T extends
|
|
4
|
+
export declare function match<T extends NodeType = NodeType, IThis extends IFencedBlockHookContext<T> = IFencedBlockHookContext<T>>(this: IThis, _api: IMatchBlockPhaseApi): IMatchBlockHook<T, IToken<T>>;
|
package/lib/types/tokenizer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Node, NodeType } from '@yozora/ast';
|
|
2
2
|
import type { ICodePoint } from '@yozora/character';
|
|
3
3
|
import type { IBlockTokenizer, IMatchBlockHookCreator } from '@yozora/core-tokenizer';
|
|
4
4
|
import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
|
|
@@ -13,7 +13,7 @@ import type { IFencedBlockHookContext, IToken, ITokenizerProps } from './types';
|
|
|
13
13
|
* @see https://github.com/syntax-tree/mdast#code
|
|
14
14
|
* @see https://github.github.com/gfm/#code-fence
|
|
15
15
|
*/
|
|
16
|
-
export declare abstract class FencedBlockTokenizer<T extends
|
|
16
|
+
export 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> {
|
|
17
17
|
protected readonly nodeType: T;
|
|
18
18
|
protected readonly markers: ICodePoint[];
|
|
19
19
|
protected readonly markersRequired: number;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NodeType } from '@yozora/ast';
|
|
2
2
|
import type { ICodePoint, INodePoint } from '@yozora/character';
|
|
3
3
|
import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, IPhrasingContentLine, ITokenizer } from '@yozora/core-tokenizer';
|
|
4
4
|
export declare const FencedBlockType = "fencedBlock";
|
|
5
5
|
export declare type FencedBlockType = typeof FencedBlockType;
|
|
6
|
-
export interface IToken<T extends
|
|
6
|
+
export interface IToken<T extends NodeType> extends IPartialYastBlockToken<T> {
|
|
7
7
|
/**
|
|
8
8
|
* Line indent of a fenced block.
|
|
9
9
|
*/
|
|
@@ -25,7 +25,7 @@ export interface IToken<T extends YastNodeType> extends IPartialYastBlockToken<T
|
|
|
25
25
|
*/
|
|
26
26
|
infoString: INodePoint[];
|
|
27
27
|
}
|
|
28
|
-
export interface IFencedBlockHookContext<T extends
|
|
28
|
+
export interface IFencedBlockHookContext<T extends NodeType> extends ITokenizer {
|
|
29
29
|
/**
|
|
30
30
|
* Type of special FencedBlock token and FencedBlock node.
|
|
31
31
|
*/
|
|
@@ -46,7 +46,7 @@ export interface IFencedBlockHookContext<T extends YastNodeType> extends ITokeni
|
|
|
46
46
|
*/
|
|
47
47
|
checkInfoString?(infoString: Readonly<INodePoint[]>, marker: ICodePoint, countOfMarker: number): boolean;
|
|
48
48
|
}
|
|
49
|
-
export interface ITokenizerProps<T extends
|
|
49
|
+
export interface ITokenizerProps<T extends NodeType> extends Partial<IBaseBlockTokenizerProps> {
|
|
50
50
|
/**
|
|
51
51
|
* ITokenizer name.
|
|
52
52
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-fenced-block",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@yozora/ast": "^2.0.0
|
|
38
|
-
"@yozora/character": "^2.0.0
|
|
39
|
-
"@yozora/core-tokenizer": "^2.0.0
|
|
37
|
+
"@yozora/ast": "^2.0.0",
|
|
38
|
+
"@yozora/character": "^2.0.0",
|
|
39
|
+
"@yozora/core-tokenizer": "^2.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "65e99d1709fdd1c918465dce6b1e91de96bdab5e"
|
|
42
42
|
}
|