@yozora/tokenizer-fenced-block 2.0.0-alpha.2 → 2.0.1
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/lib/cjs/index.js +2 -2
- package/lib/esm/index.js +3 -3
- 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/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,
|
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,
|
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.
|
|
3
|
+
"version": "2.0.1",
|
|
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.
|
|
38
|
-
"@yozora/character": "^2.0.
|
|
39
|
-
"@yozora/core-tokenizer": "^2.0.
|
|
37
|
+
"@yozora/ast": "^2.0.1",
|
|
38
|
+
"@yozora/character": "^2.0.1",
|
|
39
|
+
"@yozora/core-tokenizer": "^2.0.1"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "3aea33091e402bd6c7754d91d549e8d648475073"
|
|
42
42
|
}
|