@yozora/tokenizer-footnote-definition 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 +58 -31
- package/lib/esm/index.js +57 -32
- package/lib/types/index.d.ts +4 -4
- package/lib/types/match.d.ts +22 -0
- package/lib/types/parse.d.ts +3 -0
- package/lib/types/tokenizer.d.ts +6 -39
- package/lib/types/types.d.ts +12 -9
- package/lib/types/util.d.ts +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -83,14 +83,14 @@ so you can use `YozoraParser` directly.
|
|
|
83
83
|
registered in *YastParser* as a plugin-in before it can be used.
|
|
84
84
|
|
|
85
85
|
```typescript {4,9}
|
|
86
|
-
import {
|
|
86
|
+
import { DefaultParser } from '@yozora/core-parser'
|
|
87
87
|
import ParagraphTokenizer from '@yozora/tokenizer-paragraph'
|
|
88
88
|
import TextTokenizer from '@yozora/tokenizer-text'
|
|
89
89
|
import FootnoteDefinitionTokenizer from '@yozora/tokenizer-footnote-definition'
|
|
90
90
|
|
|
91
|
-
const parser = new
|
|
92
|
-
.
|
|
93
|
-
.
|
|
91
|
+
const parser = new DefaultParser()
|
|
92
|
+
.useFallbackTokenizer(new ParagraphTokenizer())
|
|
93
|
+
.useFallbackTokenizer(new TextTokenizer())
|
|
94
94
|
.useTokenizer(new FootnoteDefinitionTokenizer())
|
|
95
95
|
|
|
96
96
|
// parse source markdown content
|
|
@@ -278,7 +278,6 @@ Name | Type | Required | Default
|
|
|
278
278
|
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link#readme
|
|
279
279
|
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link-reference#readme
|
|
280
280
|
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list#readme
|
|
281
|
-
[@yozora/tokenizer-list-item]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list-item#readme
|
|
282
281
|
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/main/tokenizers/math#readme
|
|
283
282
|
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/main/tokenizers/paragraph#readme
|
|
284
283
|
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/main/tokenizers/setext-heading#readme
|
|
@@ -338,7 +337,6 @@ Name | Type | Required | Default
|
|
|
338
337
|
[doc-@yozora/tokenizer-definition]: https://yozora.guanghechen.com/docs/package/tokenizer-definition
|
|
339
338
|
[doc-@yozora/tokenizer-link-reference]: https://yozora.guanghechen.com/docs/package/tokenizer-link-reference
|
|
340
339
|
[doc-@yozora/tokenizer-list]: https://yozora.guanghechen.com/docs/package/tokenizer-list
|
|
341
|
-
[doc-@yozora/tokenizer-list-item]: https://yozora.guanghechen.com/docs/package/tokenizer-list-item
|
|
342
340
|
[doc-@yozora/tokenizer-math]: https://yozora.guanghechen.com/docs/package/tokenizer-math
|
|
343
341
|
[doc-@yozora/tokenizer-paragraph]: https://yozora.guanghechen.com/docs/package/tokenizer-paragraph
|
|
344
342
|
[doc-@yozora/tokenizer-setext-heading]: https://yozora.guanghechen.com/docs/package/tokenizer-setext-heading
|
package/lib/cjs/index.js
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ast = require('@yozora/ast');
|
|
6
5
|
var character = require('@yozora/character');
|
|
6
|
+
var ast = require('@yozora/ast');
|
|
7
7
|
var coreTokenizer = require('@yozora/core-tokenizer');
|
|
8
8
|
|
|
9
|
-
const uniqueName = '@yozora/tokenizer-footnote-definition';
|
|
10
|
-
|
|
11
9
|
function eatFootnoteLabel(nodePoints, firstNonWhitespaceIndex, endIndex) {
|
|
12
10
|
let i = firstNonWhitespaceIndex;
|
|
13
11
|
if (i + 1 >= endIndex ||
|
|
@@ -38,17 +36,15 @@ function eatFootnoteLabel(nodePoints, firstNonWhitespaceIndex, endIndex) {
|
|
|
38
36
|
return -1;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
eatOpener(line) {
|
|
39
|
+
const match = function (api) {
|
|
40
|
+
const { indent } = this;
|
|
41
|
+
return {
|
|
42
|
+
isContainingBlock: true,
|
|
43
|
+
eatOpener,
|
|
44
|
+
eatContinuationText,
|
|
45
|
+
onClose,
|
|
46
|
+
};
|
|
47
|
+
function eatOpener(line) {
|
|
52
48
|
if (line.countOfPrecedeSpaces >= 4)
|
|
53
49
|
return null;
|
|
54
50
|
const { nodePoints, startIndex, firstNonWhitespaceIndex, endIndex } = line;
|
|
@@ -73,40 +69,71 @@ class FootnoteDefinitionTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
|
73
69
|
};
|
|
74
70
|
return { token, nextIndex: nextIndex + 1 };
|
|
75
71
|
}
|
|
76
|
-
eatContinuationText(line) {
|
|
77
|
-
const { startIndex, endIndex, firstNonWhitespaceIndex, countOfPrecedeSpaces
|
|
72
|
+
function eatContinuationText(line) {
|
|
73
|
+
const { startIndex, endIndex, firstNonWhitespaceIndex, countOfPrecedeSpaces } = line;
|
|
78
74
|
if (firstNonWhitespaceIndex >= endIndex) {
|
|
79
75
|
return {
|
|
80
76
|
status: 'opening',
|
|
81
|
-
nextIndex: Math.min(endIndex - 1, startIndex +
|
|
77
|
+
nextIndex: Math.min(endIndex - 1, startIndex + indent),
|
|
82
78
|
};
|
|
83
79
|
}
|
|
84
|
-
if (countOfPrecedeSpaces >=
|
|
85
|
-
return { status: 'opening', nextIndex: startIndex +
|
|
80
|
+
if (countOfPrecedeSpaces >= indent) {
|
|
81
|
+
return { status: 'opening', nextIndex: startIndex + indent };
|
|
86
82
|
}
|
|
87
83
|
return { status: 'notMatched' };
|
|
88
84
|
}
|
|
89
|
-
onClose(token
|
|
85
|
+
function onClose(token) {
|
|
90
86
|
const label = character.calcStringFromNodePoints(token.label.nodePoints, token.label.startIndex + 2, token.label.endIndex - 1);
|
|
91
87
|
const identifier = coreTokenizer.resolveLabelToIdentifier(label);
|
|
92
88
|
api.registerFootnoteDefinitionIdentifier(identifier);
|
|
93
89
|
token._label = label;
|
|
94
90
|
token._identifier = identifier;
|
|
95
91
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const parse = function (api) {
|
|
95
|
+
return {
|
|
96
|
+
parse: tokens => tokens.map(token => {
|
|
97
|
+
const label = token._label;
|
|
98
|
+
const identifier = token._identifier;
|
|
99
|
+
const children = api.parseBlockTokens(token.children);
|
|
100
|
+
const node = api.shouldReservePosition
|
|
101
|
+
? {
|
|
102
|
+
type: ast.FootnoteDefinitionType,
|
|
103
|
+
position: token.position,
|
|
104
|
+
identifier,
|
|
105
|
+
label,
|
|
106
|
+
children,
|
|
107
|
+
}
|
|
108
|
+
: {
|
|
109
|
+
type: ast.FootnoteDefinitionType,
|
|
110
|
+
identifier,
|
|
111
|
+
label,
|
|
112
|
+
children,
|
|
113
|
+
};
|
|
114
|
+
return node;
|
|
115
|
+
}),
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const uniqueName = '@yozora/tokenizer-footnote-definition';
|
|
120
|
+
|
|
121
|
+
class FootnoteDefinitionTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
122
|
+
constructor(props = {}) {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
super({
|
|
125
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
126
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : coreTokenizer.TokenizerPriority.CONTAINING_BLOCK,
|
|
127
|
+
});
|
|
128
|
+
this.indent = 4;
|
|
129
|
+
this.match = match;
|
|
130
|
+
this.parse = parse;
|
|
106
131
|
}
|
|
107
132
|
}
|
|
108
133
|
|
|
109
134
|
exports.FootnoteDefinitionTokenizer = FootnoteDefinitionTokenizer;
|
|
110
135
|
exports.FootnoteDefinitionTokenizerName = uniqueName;
|
|
111
|
-
exports[
|
|
136
|
+
exports["default"] = FootnoteDefinitionTokenizer;
|
|
112
137
|
exports.eatFootnoteLabel = eatFootnoteLabel;
|
|
138
|
+
exports.footnoteDefinitionMatch = match;
|
|
139
|
+
exports.footnoteDefinitionParse = parse;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { FootnoteDefinitionType } from '@yozora/ast';
|
|
2
1
|
import { AsciiCodePoint, isWhitespaceCharacter, VirtualCodePoint, calcStringFromNodePoints } from '@yozora/character';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const uniqueName = '@yozora/tokenizer-footnote-definition';
|
|
2
|
+
import { FootnoteDefinitionType } from '@yozora/ast';
|
|
3
|
+
import { calcStartYastNodePoint, calcEndYastNodePoint, resolveLabelToIdentifier, BaseBlockTokenizer, TokenizerPriority } from '@yozora/core-tokenizer';
|
|
6
4
|
|
|
7
5
|
function eatFootnoteLabel(nodePoints, firstNonWhitespaceIndex, endIndex) {
|
|
8
6
|
let i = firstNonWhitespaceIndex;
|
|
@@ -34,17 +32,15 @@ function eatFootnoteLabel(nodePoints, firstNonWhitespaceIndex, endIndex) {
|
|
|
34
32
|
return -1;
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
eatOpener(line) {
|
|
35
|
+
const match = function (api) {
|
|
36
|
+
const { indent } = this;
|
|
37
|
+
return {
|
|
38
|
+
isContainingBlock: true,
|
|
39
|
+
eatOpener,
|
|
40
|
+
eatContinuationText,
|
|
41
|
+
onClose,
|
|
42
|
+
};
|
|
43
|
+
function eatOpener(line) {
|
|
48
44
|
if (line.countOfPrecedeSpaces >= 4)
|
|
49
45
|
return null;
|
|
50
46
|
const { nodePoints, startIndex, firstNonWhitespaceIndex, endIndex } = line;
|
|
@@ -69,37 +65,66 @@ class FootnoteDefinitionTokenizer extends BaseBlockTokenizer {
|
|
|
69
65
|
};
|
|
70
66
|
return { token, nextIndex: nextIndex + 1 };
|
|
71
67
|
}
|
|
72
|
-
eatContinuationText(line) {
|
|
73
|
-
const { startIndex, endIndex, firstNonWhitespaceIndex, countOfPrecedeSpaces
|
|
68
|
+
function eatContinuationText(line) {
|
|
69
|
+
const { startIndex, endIndex, firstNonWhitespaceIndex, countOfPrecedeSpaces } = line;
|
|
74
70
|
if (firstNonWhitespaceIndex >= endIndex) {
|
|
75
71
|
return {
|
|
76
72
|
status: 'opening',
|
|
77
|
-
nextIndex: Math.min(endIndex - 1, startIndex +
|
|
73
|
+
nextIndex: Math.min(endIndex - 1, startIndex + indent),
|
|
78
74
|
};
|
|
79
75
|
}
|
|
80
|
-
if (countOfPrecedeSpaces >=
|
|
81
|
-
return { status: 'opening', nextIndex: startIndex +
|
|
76
|
+
if (countOfPrecedeSpaces >= indent) {
|
|
77
|
+
return { status: 'opening', nextIndex: startIndex + indent };
|
|
82
78
|
}
|
|
83
79
|
return { status: 'notMatched' };
|
|
84
80
|
}
|
|
85
|
-
onClose(token
|
|
81
|
+
function onClose(token) {
|
|
86
82
|
const label = calcStringFromNodePoints(token.label.nodePoints, token.label.startIndex + 2, token.label.endIndex - 1);
|
|
87
83
|
const identifier = resolveLabelToIdentifier(label);
|
|
88
84
|
api.registerFootnoteDefinitionIdentifier(identifier);
|
|
89
85
|
token._label = label;
|
|
90
86
|
token._identifier = identifier;
|
|
91
87
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const parse = function (api) {
|
|
91
|
+
return {
|
|
92
|
+
parse: tokens => tokens.map(token => {
|
|
93
|
+
const label = token._label;
|
|
94
|
+
const identifier = token._identifier;
|
|
95
|
+
const children = api.parseBlockTokens(token.children);
|
|
96
|
+
const node = api.shouldReservePosition
|
|
97
|
+
? {
|
|
98
|
+
type: FootnoteDefinitionType,
|
|
99
|
+
position: token.position,
|
|
100
|
+
identifier,
|
|
101
|
+
label,
|
|
102
|
+
children,
|
|
103
|
+
}
|
|
104
|
+
: {
|
|
105
|
+
type: FootnoteDefinitionType,
|
|
106
|
+
identifier,
|
|
107
|
+
label,
|
|
108
|
+
children,
|
|
109
|
+
};
|
|
110
|
+
return node;
|
|
111
|
+
}),
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const uniqueName = '@yozora/tokenizer-footnote-definition';
|
|
116
|
+
|
|
117
|
+
class FootnoteDefinitionTokenizer extends BaseBlockTokenizer {
|
|
118
|
+
constructor(props = {}) {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
super({
|
|
121
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
122
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : TokenizerPriority.CONTAINING_BLOCK,
|
|
123
|
+
});
|
|
124
|
+
this.indent = 4;
|
|
125
|
+
this.match = match;
|
|
126
|
+
this.parse = parse;
|
|
102
127
|
}
|
|
103
128
|
}
|
|
104
129
|
|
|
105
|
-
export { FootnoteDefinitionTokenizer, uniqueName as FootnoteDefinitionTokenizerName, FootnoteDefinitionTokenizer as default, eatFootnoteLabel };
|
|
130
|
+
export { FootnoteDefinitionTokenizer, uniqueName as FootnoteDefinitionTokenizerName, FootnoteDefinitionTokenizer as default, eatFootnoteLabel, match as footnoteDefinitionMatch, parse as footnoteDefinitionParse };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FootnoteDefinitionTokenizer } from './tokenizer';
|
|
2
1
|
export * from './util';
|
|
3
|
-
export {
|
|
2
|
+
export { match as footnoteDefinitionMatch } from './match';
|
|
3
|
+
export { parse as footnoteDefinitionParse } from './parse';
|
|
4
|
+
export { FootnoteDefinitionTokenizer, FootnoteDefinitionTokenizer as default } from './tokenizer';
|
|
4
5
|
export { uniqueName as FootnoteDefinitionTokenizerName } from './types';
|
|
5
|
-
export type {
|
|
6
|
-
export default FootnoteDefinitionTokenizer;
|
|
6
|
+
export type { IThis as IFootnoteDefinitionHookContext, IToken as IFootnoteDefinitionToken, ITokenizerProps as IFootnoteDefinitionTokenizerProps, } from './types';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IMatchBlockHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
+
import type { IThis, IToken, T } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A footnote reference definition consists of a footnote label, indented up
|
|
5
|
+
* to three spaces, followed by a colon (:), optional whitespace (including up
|
|
6
|
+
* to one line ending), a footnote contents consisted by paragraph-like strings.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the link label, the footnote label should be on the same line and it
|
|
9
|
+
* begins with a left bracket ([) followed by a caret (^), and ends with the
|
|
10
|
+
* first right bracket (]) that is not backslash-escaped. Between the caret of
|
|
11
|
+
* right bracket, there must be at least one non-whitespace character.
|
|
12
|
+
* Unescaped square bracket characters are not allowed inside the opening creat
|
|
13
|
+
* and closing square bracket of footnote labels. A footnote label can have at
|
|
14
|
+
* most 999 characters inside the caret and right bracket.
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.github.com/gfm/#link-label
|
|
17
|
+
* @see https://github.github.com/gfm/#link-reference-definition
|
|
18
|
+
* @see https://github.com/syntax-tree/mdast-util-footnote
|
|
19
|
+
* @see https://github.com/remarkjs/remark-footnotes
|
|
20
|
+
* @see https://www.markdownguide.org/extended-syntax/#footnotes
|
|
21
|
+
*/
|
|
22
|
+
export declare const match: IMatchBlockHookCreator<T, IToken, IThis>;
|
package/lib/types/tokenizer.d.ts
CHANGED
|
@@ -1,50 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { MatchBlockPhaseApi, PhrasingContentLine, ResultOfEatContinuationText, ResultOfEatOpener, ResultOfOnClose, ResultOfParse, Tokenizer, TokenizerMatchBlockHook, TokenizerParseBlockHook } from '@yozora/core-tokenizer';
|
|
1
|
+
import type { IBlockTokenizer, IMatchBlockHookCreator, IParseBlockHookCreator } from '@yozora/core-tokenizer';
|
|
3
2
|
import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
|
|
4
|
-
import type {
|
|
3
|
+
import type { INode, IThis, IToken, ITokenizerProps, T } from './types';
|
|
5
4
|
/**
|
|
6
5
|
* Lexical Analyzer for FootnoteDefinition.
|
|
7
|
-
*
|
|
8
|
-
* A footnote reference definition consists of a footnote label, indented up
|
|
9
|
-
* to three spaces, followed by a colon (:), optional whitespace (including up
|
|
10
|
-
* to one line ending), a footnote contents consisted by paragraph-like strings.
|
|
11
|
-
*
|
|
12
|
-
* Unlike the link label, the footnote label should be on the same line and it
|
|
13
|
-
* begins with a left bracket ([) followed by a caret (^), and ends with the
|
|
14
|
-
* first right bracket (]) that is not backslash-escaped. Between the caret of
|
|
15
|
-
* right bracket, there must be at least one non-whitespace character.
|
|
16
|
-
* Unescaped square bracket characters are not allowed inside the opening creat
|
|
17
|
-
* and closing square bracket of footnote labels. A footnote label can have at
|
|
18
|
-
* most 999 characters inside the caret and right bracket.
|
|
19
|
-
*
|
|
20
6
|
* @see https://github.github.com/gfm/#link-label
|
|
21
7
|
* @see https://github.github.com/gfm/#link-reference-definition
|
|
22
8
|
* @see https://github.com/syntax-tree/mdast-util-footnote
|
|
23
9
|
* @see https://github.com/remarkjs/remark-footnotes
|
|
24
10
|
* @see https://www.markdownguide.org/extended-syntax/#footnotes
|
|
25
11
|
*/
|
|
26
|
-
export declare class FootnoteDefinitionTokenizer extends BaseBlockTokenizer
|
|
27
|
-
|
|
12
|
+
export declare class FootnoteDefinitionTokenizer extends BaseBlockTokenizer<T, IToken, INode, IThis> implements IBlockTokenizer<T, IToken, INode, IThis> {
|
|
13
|
+
constructor(props?: ITokenizerProps);
|
|
28
14
|
readonly indent = 4;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* @override
|
|
32
|
-
* @see TokenizerMatchBlockHook
|
|
33
|
-
*/
|
|
34
|
-
eatOpener(line: Readonly<PhrasingContentLine>): ResultOfEatOpener<T, Token>;
|
|
35
|
-
/**
|
|
36
|
-
* @override
|
|
37
|
-
* @see TokenizerMatchBlockHook
|
|
38
|
-
*/
|
|
39
|
-
eatContinuationText(line: Readonly<PhrasingContentLine>): ResultOfEatContinuationText;
|
|
40
|
-
/**
|
|
41
|
-
* @override
|
|
42
|
-
* @see TokenizerMatchBlockHook
|
|
43
|
-
*/
|
|
44
|
-
onClose(token: Token, api: Readonly<MatchBlockPhaseApi>): ResultOfOnClose;
|
|
45
|
-
/**
|
|
46
|
-
* @override
|
|
47
|
-
* @see TokenizerParseBlockHook
|
|
48
|
-
*/
|
|
49
|
-
parseBlock(token: Readonly<Token>, children?: YastNode[]): ResultOfParse<T, Node>;
|
|
15
|
+
readonly match: IMatchBlockHookCreator<T, IToken, IThis>;
|
|
16
|
+
readonly parse: IParseBlockHookCreator<T, IToken, INode, IThis>;
|
|
50
17
|
}
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { FootnoteDefinitionType, IFootnoteDefinition } from '@yozora/ast';
|
|
2
|
+
import type { INodeInterval, INodePoint } from '@yozora/character';
|
|
3
|
+
import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, ITokenizer, IYastBlockToken } from '@yozora/core-tokenizer';
|
|
4
4
|
export declare type T = FootnoteDefinitionType;
|
|
5
|
-
export declare type
|
|
5
|
+
export declare type INode = IFootnoteDefinition;
|
|
6
6
|
export declare const uniqueName = "@yozora/tokenizer-footnote-definition";
|
|
7
|
-
export interface
|
|
7
|
+
export interface IToken extends IPartialYastBlockToken<T> {
|
|
8
8
|
/**
|
|
9
9
|
* Footnote label
|
|
10
10
|
*/
|
|
11
|
-
label:
|
|
12
|
-
nodePoints: ReadonlyArray<
|
|
11
|
+
label: INodeInterval & {
|
|
12
|
+
nodePoints: ReadonlyArray<INodePoint>;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
children:
|
|
17
|
+
children: IYastBlockToken[];
|
|
18
18
|
/**
|
|
19
19
|
* Resolved definition label.
|
|
20
20
|
*/
|
|
@@ -24,4 +24,7 @@ export interface Token extends PartialYastBlockToken<T> {
|
|
|
24
24
|
*/
|
|
25
25
|
_identifier?: string;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export interface IThis extends ITokenizer {
|
|
28
|
+
indent: number;
|
|
29
|
+
}
|
|
30
|
+
export declare type ITokenizerProps = Partial<IBaseBlockTokenizerProps>;
|
package/lib/types/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { INodePoint } from '@yozora/character';
|
|
2
2
|
/**
|
|
3
3
|
* Try to match a footnote label.
|
|
4
4
|
*
|
|
@@ -15,4 +15,4 @@ import type { NodePoint } from '@yozora/character';
|
|
|
15
15
|
* @param endIndex
|
|
16
16
|
* @see https://github.github.com/gfm/#link-label
|
|
17
17
|
*/
|
|
18
|
-
export declare function eatFootnoteLabel(nodePoints: ReadonlyArray<
|
|
18
|
+
export declare function eatFootnoteLabel(nodePoints: ReadonlyArray<INodePoint>, firstNonWhitespaceIndex: number, endIndex: number): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-footnote-definition",
|
|
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
|
}
|