@yozora/tokenizer-heading 1.2.2 → 2.0.0-alpha.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 +4 -6
- package/lib/cjs/index.js +65 -51
- package/lib/esm/index.js +64 -52
- package/lib/types/index.d.ts +4 -4
- package/lib/types/match.d.ts +17 -0
- package/lib/types/parse.d.ts +3 -0
- package/lib/types/tokenizer.d.ts +6 -31
- package/lib/types/types.d.ts +7 -6
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -84,14 +84,14 @@ so you can use `YozoraParser` / `GfmExParser` / `GfmParser` directly.
|
|
|
84
84
|
registered in *YastParser* as a plugin-in before it can be used.
|
|
85
85
|
|
|
86
86
|
```typescript {4,9}
|
|
87
|
-
import {
|
|
87
|
+
import { DefaultParser } from '@yozora/core-parser'
|
|
88
88
|
import ParagraphTokenizer from '@yozora/tokenizer-paragraph'
|
|
89
89
|
import TextTokenizer from '@yozora/tokenizer-text'
|
|
90
90
|
import HeadingTokenizer from '@yozora/tokenizer-heading'
|
|
91
91
|
|
|
92
|
-
const parser = new
|
|
93
|
-
.
|
|
94
|
-
.
|
|
92
|
+
const parser = new DefaultParser()
|
|
93
|
+
.useFallbackTokenizer(new ParagraphTokenizer())
|
|
94
|
+
.useFallbackTokenizer(new TextTokenizer())
|
|
95
95
|
.useTokenizer(new HeadingTokenizer())
|
|
96
96
|
|
|
97
97
|
// parse source markdown content
|
|
@@ -238,7 +238,6 @@ Name | Type | Required | Default
|
|
|
238
238
|
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link#readme
|
|
239
239
|
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link-reference#readme
|
|
240
240
|
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list#readme
|
|
241
|
-
[@yozora/tokenizer-list-item]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list-item#readme
|
|
242
241
|
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/main/tokenizers/math#readme
|
|
243
242
|
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/main/tokenizers/paragraph#readme
|
|
244
243
|
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/main/tokenizers/setext-heading#readme
|
|
@@ -298,7 +297,6 @@ Name | Type | Required | Default
|
|
|
298
297
|
[doc-@yozora/tokenizer-definition]: https://yozora.guanghechen.com/docs/package/tokenizer-definition
|
|
299
298
|
[doc-@yozora/tokenizer-link-reference]: https://yozora.guanghechen.com/docs/package/tokenizer-link-reference
|
|
300
299
|
[doc-@yozora/tokenizer-list]: https://yozora.guanghechen.com/docs/package/tokenizer-list
|
|
301
|
-
[doc-@yozora/tokenizer-list-item]: https://yozora.guanghechen.com/docs/package/tokenizer-list-item
|
|
302
300
|
[doc-@yozora/tokenizer-math]: https://yozora.guanghechen.com/docs/package/tokenizer-math
|
|
303
301
|
[doc-@yozora/tokenizer-paragraph]: https://yozora.guanghechen.com/docs/package/tokenizer-paragraph
|
|
304
302
|
[doc-@yozora/tokenizer-setext-heading]: https://yozora.guanghechen.com/docs/package/tokenizer-setext-heading
|
package/lib/cjs/index.js
CHANGED
|
@@ -6,24 +6,18 @@ var ast = require('@yozora/ast');
|
|
|
6
6
|
var character = require('@yozora/character');
|
|
7
7
|
var coreTokenizer = require('@yozora/core-tokenizer');
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : coreTokenizer.TokenizerPriority.ATOMIC,
|
|
17
|
-
});
|
|
18
|
-
this.isContainingBlock = false;
|
|
19
|
-
}
|
|
20
|
-
eatOpener(line) {
|
|
9
|
+
const match = function () {
|
|
10
|
+
return {
|
|
11
|
+
isContainingBlock: false,
|
|
12
|
+
eatOpener,
|
|
13
|
+
eatAndInterruptPreviousSibling,
|
|
14
|
+
};
|
|
15
|
+
function eatOpener(line) {
|
|
21
16
|
if (line.countOfPrecedeSpaces >= 4)
|
|
22
17
|
return null;
|
|
23
18
|
const { nodePoints, startIndex, endIndex, firstNonWhitespaceIndex } = line;
|
|
24
19
|
if (firstNonWhitespaceIndex >= endIndex ||
|
|
25
|
-
nodePoints[firstNonWhitespaceIndex].codePoint !==
|
|
26
|
-
character.AsciiCodePoint.NUMBER_SIGN) {
|
|
20
|
+
nodePoints[firstNonWhitespaceIndex].codePoint !== character.AsciiCodePoint.NUMBER_SIGN) {
|
|
27
21
|
return null;
|
|
28
22
|
}
|
|
29
23
|
const i = coreTokenizer.eatOptionalCharacters(nodePoints, firstNonWhitespaceIndex + 1, endIndex, character.AsciiCodePoint.NUMBER_SIGN);
|
|
@@ -44,8 +38,8 @@ class HeadingTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
|
44
38
|
};
|
|
45
39
|
return { token, nextIndex, saturated: true };
|
|
46
40
|
}
|
|
47
|
-
eatAndInterruptPreviousSibling(line, prevSiblingToken) {
|
|
48
|
-
const result =
|
|
41
|
+
function eatAndInterruptPreviousSibling(line, prevSiblingToken) {
|
|
42
|
+
const result = eatOpener(line);
|
|
49
43
|
if (result == null)
|
|
50
44
|
return null;
|
|
51
45
|
return {
|
|
@@ -54,47 +48,67 @@ class HeadingTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
|
54
48
|
remainingSibling: prevSiblingToken,
|
|
55
49
|
};
|
|
56
50
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (closeCharCount > 0) {
|
|
68
|
-
let spaceCount = 0, j = rightIndex - 1 - closeCharCount;
|
|
69
|
-
for (; j >= leftIndex; --j) {
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const parse = function (api) {
|
|
54
|
+
return {
|
|
55
|
+
parse: tokens => tokens.map(token => {
|
|
56
|
+
const { nodePoints, firstNonWhitespaceIndex, endIndex } = token.line;
|
|
57
|
+
let [leftIndex, rightIndex] = character.calcTrimBoundaryOfCodePoints(nodePoints, firstNonWhitespaceIndex + token.depth, endIndex);
|
|
58
|
+
let closeCharCount = 0;
|
|
59
|
+
for (let j = rightIndex - 1; j >= leftIndex; --j) {
|
|
70
60
|
const c = nodePoints[j].codePoint;
|
|
71
|
-
if (
|
|
61
|
+
if (c !== character.AsciiCodePoint.NUMBER_SIGN)
|
|
72
62
|
break;
|
|
73
|
-
|
|
63
|
+
closeCharCount += 1;
|
|
74
64
|
}
|
|
75
|
-
if (
|
|
76
|
-
rightIndex
|
|
65
|
+
if (closeCharCount > 0) {
|
|
66
|
+
let spaceCount = 0, j = rightIndex - 1 - closeCharCount;
|
|
67
|
+
for (; j >= leftIndex; --j) {
|
|
68
|
+
const c = nodePoints[j].codePoint;
|
|
69
|
+
if (!character.isWhitespaceCharacter(c))
|
|
70
|
+
break;
|
|
71
|
+
spaceCount += 1;
|
|
72
|
+
}
|
|
73
|
+
if (spaceCount > 0 || j < leftIndex) {
|
|
74
|
+
rightIndex -= closeCharCount + spaceCount;
|
|
75
|
+
}
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
77
|
+
const lines = [
|
|
78
|
+
{
|
|
79
|
+
nodePoints,
|
|
80
|
+
startIndex: leftIndex,
|
|
81
|
+
endIndex: rightIndex,
|
|
82
|
+
firstNonWhitespaceIndex: leftIndex,
|
|
83
|
+
countOfPrecedeSpaces: 0,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
const contents = coreTokenizer.mergeAndStripContentLines(lines);
|
|
87
|
+
const children = api.processInlines(contents);
|
|
88
|
+
const node = api.shouldReservePosition
|
|
89
|
+
? { type: ast.HeadingType, position: token.position, depth: token.depth, children }
|
|
90
|
+
: { type: ast.HeadingType, depth: token.depth, children };
|
|
91
|
+
return node;
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const uniqueName = '@yozora/tokenizer-heading';
|
|
97
|
+
|
|
98
|
+
class HeadingTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
99
|
+
constructor(props = {}) {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
super({
|
|
102
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
103
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : coreTokenizer.TokenizerPriority.ATOMIC,
|
|
104
|
+
});
|
|
105
|
+
this.match = match;
|
|
106
|
+
this.parse = parse;
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
|
|
98
110
|
exports.HeadingTokenizer = HeadingTokenizer;
|
|
99
111
|
exports.HeadingTokenizerName = uniqueName;
|
|
100
|
-
exports[
|
|
112
|
+
exports["default"] = HeadingTokenizer;
|
|
113
|
+
exports.headingMatch = match;
|
|
114
|
+
exports.headingParse = parse;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
import { HeadingType } from '@yozora/ast';
|
|
2
2
|
import { AsciiCodePoint, isSpaceCharacter, calcTrimBoundaryOfCodePoints, isWhitespaceCharacter } from '@yozora/character';
|
|
3
|
-
import {
|
|
3
|
+
import { eatOptionalCharacters, calcStartYastNodePoint, calcEndYastNodePoint, mergeAndStripContentLines, BaseBlockTokenizer, TokenizerPriority } from '@yozora/core-tokenizer';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : TokenizerPriority.ATOMIC,
|
|
13
|
-
});
|
|
14
|
-
this.isContainingBlock = false;
|
|
15
|
-
}
|
|
16
|
-
eatOpener(line) {
|
|
5
|
+
const match = function () {
|
|
6
|
+
return {
|
|
7
|
+
isContainingBlock: false,
|
|
8
|
+
eatOpener,
|
|
9
|
+
eatAndInterruptPreviousSibling,
|
|
10
|
+
};
|
|
11
|
+
function eatOpener(line) {
|
|
17
12
|
if (line.countOfPrecedeSpaces >= 4)
|
|
18
13
|
return null;
|
|
19
14
|
const { nodePoints, startIndex, endIndex, firstNonWhitespaceIndex } = line;
|
|
20
15
|
if (firstNonWhitespaceIndex >= endIndex ||
|
|
21
|
-
nodePoints[firstNonWhitespaceIndex].codePoint !==
|
|
22
|
-
AsciiCodePoint.NUMBER_SIGN) {
|
|
16
|
+
nodePoints[firstNonWhitespaceIndex].codePoint !== AsciiCodePoint.NUMBER_SIGN) {
|
|
23
17
|
return null;
|
|
24
18
|
}
|
|
25
19
|
const i = eatOptionalCharacters(nodePoints, firstNonWhitespaceIndex + 1, endIndex, AsciiCodePoint.NUMBER_SIGN);
|
|
@@ -40,8 +34,8 @@ class HeadingTokenizer extends BaseBlockTokenizer {
|
|
|
40
34
|
};
|
|
41
35
|
return { token, nextIndex, saturated: true };
|
|
42
36
|
}
|
|
43
|
-
eatAndInterruptPreviousSibling(line, prevSiblingToken) {
|
|
44
|
-
const result =
|
|
37
|
+
function eatAndInterruptPreviousSibling(line, prevSiblingToken) {
|
|
38
|
+
const result = eatOpener(line);
|
|
45
39
|
if (result == null)
|
|
46
40
|
return null;
|
|
47
41
|
return {
|
|
@@ -50,45 +44,63 @@ class HeadingTokenizer extends BaseBlockTokenizer {
|
|
|
50
44
|
remainingSibling: prevSiblingToken,
|
|
51
45
|
};
|
|
52
46
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (closeCharCount > 0) {
|
|
64
|
-
let spaceCount = 0, j = rightIndex - 1 - closeCharCount;
|
|
65
|
-
for (; j >= leftIndex; --j) {
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const parse = function (api) {
|
|
50
|
+
return {
|
|
51
|
+
parse: tokens => tokens.map(token => {
|
|
52
|
+
const { nodePoints, firstNonWhitespaceIndex, endIndex } = token.line;
|
|
53
|
+
let [leftIndex, rightIndex] = calcTrimBoundaryOfCodePoints(nodePoints, firstNonWhitespaceIndex + token.depth, endIndex);
|
|
54
|
+
let closeCharCount = 0;
|
|
55
|
+
for (let j = rightIndex - 1; j >= leftIndex; --j) {
|
|
66
56
|
const c = nodePoints[j].codePoint;
|
|
67
|
-
if (
|
|
57
|
+
if (c !== AsciiCodePoint.NUMBER_SIGN)
|
|
68
58
|
break;
|
|
69
|
-
|
|
59
|
+
closeCharCount += 1;
|
|
70
60
|
}
|
|
71
|
-
if (
|
|
72
|
-
rightIndex
|
|
61
|
+
if (closeCharCount > 0) {
|
|
62
|
+
let spaceCount = 0, j = rightIndex - 1 - closeCharCount;
|
|
63
|
+
for (; j >= leftIndex; --j) {
|
|
64
|
+
const c = nodePoints[j].codePoint;
|
|
65
|
+
if (!isWhitespaceCharacter(c))
|
|
66
|
+
break;
|
|
67
|
+
spaceCount += 1;
|
|
68
|
+
}
|
|
69
|
+
if (spaceCount > 0 || j < leftIndex) {
|
|
70
|
+
rightIndex -= closeCharCount + spaceCount;
|
|
71
|
+
}
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
73
|
+
const lines = [
|
|
74
|
+
{
|
|
75
|
+
nodePoints,
|
|
76
|
+
startIndex: leftIndex,
|
|
77
|
+
endIndex: rightIndex,
|
|
78
|
+
firstNonWhitespaceIndex: leftIndex,
|
|
79
|
+
countOfPrecedeSpaces: 0,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
const contents = mergeAndStripContentLines(lines);
|
|
83
|
+
const children = api.processInlines(contents);
|
|
84
|
+
const node = api.shouldReservePosition
|
|
85
|
+
? { type: HeadingType, position: token.position, depth: token.depth, children }
|
|
86
|
+
: { type: HeadingType, depth: token.depth, children };
|
|
87
|
+
return node;
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const uniqueName = '@yozora/tokenizer-heading';
|
|
93
|
+
|
|
94
|
+
class HeadingTokenizer extends BaseBlockTokenizer {
|
|
95
|
+
constructor(props = {}) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
super({
|
|
98
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
99
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : TokenizerPriority.ATOMIC,
|
|
100
|
+
});
|
|
101
|
+
this.match = match;
|
|
102
|
+
this.parse = parse;
|
|
91
103
|
}
|
|
92
104
|
}
|
|
93
105
|
|
|
94
|
-
export { HeadingTokenizer, uniqueName as HeadingTokenizerName, HeadingTokenizer as default };
|
|
106
|
+
export { HeadingTokenizer, uniqueName as HeadingTokenizerName, HeadingTokenizer as default, match as headingMatch, parse as headingParse };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { match as headingMatch } from './match';
|
|
2
|
+
export { parse as headingParse } from './parse';
|
|
3
|
+
export { HeadingTokenizer, HeadingTokenizer as default } from './tokenizer';
|
|
3
4
|
export { uniqueName as HeadingTokenizerName } from './types';
|
|
4
|
-
export type {
|
|
5
|
-
export default HeadingTokenizer;
|
|
5
|
+
export type { IThis as IHeadingHookContext, IToken as IHeadingToken, ITokenizerProps as IHeadingTokenizerProps, } from './types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IMatchBlockHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
+
import type { IThis, IToken, T } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* An ATX heading consists of a string of characters, parsed as inline content,
|
|
5
|
+
* between an opening sequence of 1–6 unescaped '#' characters and an optional
|
|
6
|
+
* closing sequence of any number of unescaped '#' characters. The opening
|
|
7
|
+
* sequence of '#' characters must be followed by a space or by the end of line.
|
|
8
|
+
* The optional closing sequence of #s must be preceded by a space and may be
|
|
9
|
+
* followed by spaces only. The opening # character may be indented 0-3 spaces.
|
|
10
|
+
* The raw contents of the heading are stripped of leading and trailing spaces
|
|
11
|
+
* before being parsed as inline content. The heading level is equal to the
|
|
12
|
+
* number of '#' characters in the opening sequence.
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/syntax-tree/mdast#heading
|
|
15
|
+
* @see https://github.github.com/gfm/#atx-heading
|
|
16
|
+
*/
|
|
17
|
+
export declare const match: IMatchBlockHookCreator<T, IToken, IThis>;
|
package/lib/types/tokenizer.d.ts
CHANGED
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IBlockTokenizer, IMatchBlockHookCreator, IParseBlockHookCreator } from '@yozora/core-tokenizer';
|
|
2
2
|
import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
|
|
3
|
-
import type {
|
|
3
|
+
import type { INode, IThis, IToken, ITokenizerProps, T } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Lexical Analyzer for Heading.
|
|
6
|
-
*
|
|
7
|
-
* An ATX heading consists of a string of characters, parsed as inline content,
|
|
8
|
-
* between an opening sequence of 1–6 unescaped '#' characters and an optional
|
|
9
|
-
* closing sequence of any number of unescaped '#' characters. The opening
|
|
10
|
-
* sequence of '#' characters must be followed by a space or by the end of line.
|
|
11
|
-
* The optional closing sequence of #s must be preceded by a space and may be
|
|
12
|
-
* followed by spaces only. The opening # character may be indented 0-3 spaces.
|
|
13
|
-
* The raw contents of the heading are stripped of leading and trailing spaces
|
|
14
|
-
* before being parsed as inline content. The heading level is equal to the
|
|
15
|
-
* number of '#' characters in the opening sequence.
|
|
16
|
-
*
|
|
17
6
|
* @see https://github.com/syntax-tree/mdast#heading
|
|
18
7
|
* @see https://github.github.com/gfm/#atx-heading
|
|
19
8
|
*/
|
|
20
|
-
export declare class HeadingTokenizer extends BaseBlockTokenizer
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* @override
|
|
25
|
-
* @see TokenizerMatchBlockHook
|
|
26
|
-
*/
|
|
27
|
-
eatOpener(line: Readonly<PhrasingContentLine>): ResultOfEatOpener<T, Token>;
|
|
28
|
-
/**
|
|
29
|
-
* @override
|
|
30
|
-
* @see TokenizerMatchBlockHook
|
|
31
|
-
*/
|
|
32
|
-
eatAndInterruptPreviousSibling(line: Readonly<PhrasingContentLine>, prevSiblingToken: Readonly<YastBlockToken>): ResultOfEatAndInterruptPreviousSibling<T, Token>;
|
|
33
|
-
/**
|
|
34
|
-
* @override
|
|
35
|
-
* @see TokenizerParseBlockHook
|
|
36
|
-
*/
|
|
37
|
-
parseBlock(token: Readonly<Token>, children: undefined, api: Readonly<ParseBlockPhaseApi>): ResultOfParse<T, Node>;
|
|
9
|
+
export declare class HeadingTokenizer extends BaseBlockTokenizer<T, IToken, INode, IThis> implements IBlockTokenizer<T, IToken, INode, IThis> {
|
|
10
|
+
constructor(props?: ITokenizerProps);
|
|
11
|
+
readonly match: IMatchBlockHookCreator<T, IToken, IThis>;
|
|
12
|
+
readonly parse: IParseBlockHookCreator<T, IToken, INode, IThis>;
|
|
38
13
|
}
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { HeadingType, IHeading } from '@yozora/ast';
|
|
2
|
+
import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, IPhrasingContentLine, ITokenizer } from '@yozora/core-tokenizer';
|
|
3
3
|
export declare type T = HeadingType;
|
|
4
|
-
export declare type
|
|
4
|
+
export declare type INode = IHeading;
|
|
5
5
|
export declare const uniqueName = "@yozora/tokenizer-heading";
|
|
6
|
-
export interface
|
|
6
|
+
export interface IToken extends IPartialYastBlockToken<T> {
|
|
7
7
|
/**
|
|
8
8
|
* Level of heading
|
|
9
9
|
*/
|
|
@@ -11,6 +11,7 @@ export interface Token extends PartialYastBlockToken<T> {
|
|
|
11
11
|
/**
|
|
12
12
|
* Contents
|
|
13
13
|
*/
|
|
14
|
-
line: Readonly<
|
|
14
|
+
line: Readonly<IPhrasingContentLine>;
|
|
15
15
|
}
|
|
16
|
-
export declare type
|
|
16
|
+
export declare type IThis = ITokenizer;
|
|
17
|
+
export declare type ITokenizerProps = Partial<IBaseBlockTokenizerProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-heading",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yozora/ast": "^
|
|
39
|
-
"@yozora/character": "^
|
|
40
|
-
"@yozora/core-tokenizer": "^
|
|
38
|
+
"@yozora/ast": "^2.0.0-alpha.2",
|
|
39
|
+
"@yozora/character": "^2.0.0-alpha.2",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.0-alpha.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "da59d85520455c59a117a35032ef1a035c10ea21"
|
|
43
43
|
}
|