@yozora/tokenizer-autolink 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 +45 -29
- package/lib/esm/index.js +44 -30
- package/lib/types/index.d.ts +4 -4
- package/lib/types/match.d.ts +9 -0
- package/lib/types/parse.d.ts +3 -0
- package/lib/types/tokenizer.d.ts +6 -25
- package/lib/types/types.d.ts +10 -9
- package/lib/types/util/email.d.ts +3 -3
- package/lib/types/util/uri.d.ts +4 -4
- 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 AutolinkTokenizer from '@yozora/tokenizer-autolink'
|
|
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 AutolinkTokenizer())
|
|
96
96
|
|
|
97
97
|
// parse source markdown content
|
|
@@ -241,7 +241,6 @@ Name | Type | Required | Default
|
|
|
241
241
|
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link#readme
|
|
242
242
|
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/main/tokenizers/link-reference#readme
|
|
243
243
|
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list#readme
|
|
244
|
-
[@yozora/tokenizer-list-item]: https://github.com/yozorajs/yozora/tree/main/tokenizers/list-item#readme
|
|
245
244
|
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/main/tokenizers/math#readme
|
|
246
245
|
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/main/tokenizers/paragraph#readme
|
|
247
246
|
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/main/tokenizers/setext-heading#readme
|
|
@@ -301,7 +300,6 @@ Name | Type | Required | Default
|
|
|
301
300
|
[doc-@yozora/tokenizer-definition]: https://yozora.guanghechen.com/docs/package/tokenizer-definition
|
|
302
301
|
[doc-@yozora/tokenizer-link-reference]: https://yozora.guanghechen.com/docs/package/tokenizer-link-reference
|
|
303
302
|
[doc-@yozora/tokenizer-list]: https://yozora.guanghechen.com/docs/package/tokenizer-list
|
|
304
|
-
[doc-@yozora/tokenizer-list-item]: https://yozora.guanghechen.com/docs/package/tokenizer-list-item
|
|
305
303
|
[doc-@yozora/tokenizer-math]: https://yozora.guanghechen.com/docs/package/tokenizer-math
|
|
306
304
|
[doc-@yozora/tokenizer-paragraph]: https://yozora.guanghechen.com/docs/package/tokenizer-paragraph
|
|
307
305
|
[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-autolink';
|
|
10
|
-
|
|
11
9
|
function eatEmailAddress(nodePoints, startIndex, endIndex) {
|
|
12
10
|
let i = startIndex;
|
|
13
11
|
for (; i < endIndex; i += 1) {
|
|
@@ -109,15 +107,13 @@ const helpers = [
|
|
|
109
107
|
{ contentType: 'uri', eat: eatAbsoluteUri },
|
|
110
108
|
{ contentType: 'email', eat: eatEmailAddress },
|
|
111
109
|
];
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
_findDelimiter(startIndex, endIndex, nodePoints) {
|
|
110
|
+
const match = function (api) {
|
|
111
|
+
return {
|
|
112
|
+
findDelimiter: () => coreTokenizer.genFindDelimiter(_findDelimiter),
|
|
113
|
+
processSingleDelimiter,
|
|
114
|
+
};
|
|
115
|
+
function _findDelimiter(startIndex, endIndex) {
|
|
116
|
+
const nodePoints = api.getNodePoints();
|
|
121
117
|
for (let i = startIndex; i < endIndex; ++i) {
|
|
122
118
|
if (nodePoints[i].codePoint !== character.AsciiCodePoint.OPEN_ANGLE)
|
|
123
119
|
continue;
|
|
@@ -136,8 +132,7 @@ class AutolinkTokenizer extends coreTokenizer.BaseInlineTokenizer {
|
|
|
136
132
|
i = Math.max(i, nextIndex - 1);
|
|
137
133
|
continue;
|
|
138
134
|
}
|
|
139
|
-
if (nextIndex < endIndex &&
|
|
140
|
-
nodePoints[nextIndex].codePoint === character.AsciiCodePoint.CLOSE_ANGLE) {
|
|
135
|
+
if (nextIndex < endIndex && nodePoints[nextIndex].codePoint === character.AsciiCodePoint.CLOSE_ANGLE) {
|
|
141
136
|
return {
|
|
142
137
|
type: 'full',
|
|
143
138
|
startIndex: i,
|
|
@@ -149,34 +144,55 @@ class AutolinkTokenizer extends coreTokenizer.BaseInlineTokenizer {
|
|
|
149
144
|
}
|
|
150
145
|
return null;
|
|
151
146
|
}
|
|
152
|
-
processSingleDelimiter(delimiter
|
|
147
|
+
function processSingleDelimiter(delimiter) {
|
|
153
148
|
const token = {
|
|
154
149
|
nodeType: ast.LinkType,
|
|
155
150
|
startIndex: delimiter.startIndex,
|
|
156
151
|
endIndex: delimiter.endIndex,
|
|
157
152
|
contentType: delimiter.contentType,
|
|
158
|
-
children: api.resolveFallbackTokens([], delimiter.startIndex + 1, delimiter.endIndex - 1
|
|
153
|
+
children: api.resolveFallbackTokens([], delimiter.startIndex + 1, delimiter.endIndex - 1),
|
|
159
154
|
};
|
|
160
155
|
return [token];
|
|
161
156
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const parse = function (api) {
|
|
160
|
+
return {
|
|
161
|
+
parse: tokens => tokens.map(token => {
|
|
162
|
+
const nodePoints = api.getNodePoints();
|
|
163
|
+
let url = character.calcStringFromNodePoints(nodePoints, token.startIndex + 1, token.endIndex - 1);
|
|
164
|
+
if (token.contentType === 'email') {
|
|
165
|
+
url = 'mailto:' + url;
|
|
166
|
+
}
|
|
167
|
+
const encodedUrl = coreTokenizer.encodeLinkDestination(url);
|
|
168
|
+
const children = api.parseInlineTokens(token.children);
|
|
169
|
+
const node = api.shouldReservePosition
|
|
170
|
+
? { type: ast.LinkType, position: api.calcPosition(token), url: encodedUrl, children }
|
|
171
|
+
: { type: ast.LinkType, url: encodedUrl, children };
|
|
172
|
+
return node;
|
|
173
|
+
}),
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const uniqueName = '@yozora/tokenizer-autolink';
|
|
178
|
+
|
|
179
|
+
class AutolinkTokenizer extends coreTokenizer.BaseInlineTokenizer {
|
|
180
|
+
constructor(props = {}) {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
super({
|
|
183
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
184
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : coreTokenizer.TokenizerPriority.ATOMIC,
|
|
185
|
+
});
|
|
186
|
+
this.match = match;
|
|
187
|
+
this.parse = parse;
|
|
174
188
|
}
|
|
175
189
|
}
|
|
176
190
|
|
|
177
191
|
exports.AutolinkTokenizer = AutolinkTokenizer;
|
|
178
192
|
exports.AutolinkTokenizerName = uniqueName;
|
|
179
|
-
exports
|
|
193
|
+
exports.autolinkMatch = match;
|
|
194
|
+
exports.autolinkParse = parse;
|
|
195
|
+
exports["default"] = AutolinkTokenizer;
|
|
180
196
|
exports.eatAbsoluteUri = eatAbsoluteUri;
|
|
181
197
|
exports.eatAutolinkSchema = eatAutolinkSchema;
|
|
182
198
|
exports.eatEmailAddress = eatEmailAddress;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { LinkType } from '@yozora/ast';
|
|
2
1
|
import { isAsciiLetter, isAsciiDigitCharacter, AsciiCodePoint, isAlphanumeric, isAsciiCharacter, isWhitespaceCharacter, isAsciiControlCharacter, calcStringFromNodePoints } from '@yozora/character';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const uniqueName = '@yozora/tokenizer-autolink';
|
|
2
|
+
import { LinkType } from '@yozora/ast';
|
|
3
|
+
import { genFindDelimiter, encodeLinkDestination, BaseInlineTokenizer, TokenizerPriority } from '@yozora/core-tokenizer';
|
|
6
4
|
|
|
7
5
|
function eatEmailAddress(nodePoints, startIndex, endIndex) {
|
|
8
6
|
let i = startIndex;
|
|
@@ -105,15 +103,13 @@ const helpers = [
|
|
|
105
103
|
{ contentType: 'uri', eat: eatAbsoluteUri },
|
|
106
104
|
{ contentType: 'email', eat: eatEmailAddress },
|
|
107
105
|
];
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
_findDelimiter(startIndex, endIndex, nodePoints) {
|
|
106
|
+
const match = function (api) {
|
|
107
|
+
return {
|
|
108
|
+
findDelimiter: () => genFindDelimiter(_findDelimiter),
|
|
109
|
+
processSingleDelimiter,
|
|
110
|
+
};
|
|
111
|
+
function _findDelimiter(startIndex, endIndex) {
|
|
112
|
+
const nodePoints = api.getNodePoints();
|
|
117
113
|
for (let i = startIndex; i < endIndex; ++i) {
|
|
118
114
|
if (nodePoints[i].codePoint !== AsciiCodePoint.OPEN_ANGLE)
|
|
119
115
|
continue;
|
|
@@ -132,8 +128,7 @@ class AutolinkTokenizer extends BaseInlineTokenizer {
|
|
|
132
128
|
i = Math.max(i, nextIndex - 1);
|
|
133
129
|
continue;
|
|
134
130
|
}
|
|
135
|
-
if (nextIndex < endIndex &&
|
|
136
|
-
nodePoints[nextIndex].codePoint === AsciiCodePoint.CLOSE_ANGLE) {
|
|
131
|
+
if (nextIndex < endIndex && nodePoints[nextIndex].codePoint === AsciiCodePoint.CLOSE_ANGLE) {
|
|
137
132
|
return {
|
|
138
133
|
type: 'full',
|
|
139
134
|
startIndex: i,
|
|
@@ -145,29 +140,48 @@ class AutolinkTokenizer extends BaseInlineTokenizer {
|
|
|
145
140
|
}
|
|
146
141
|
return null;
|
|
147
142
|
}
|
|
148
|
-
processSingleDelimiter(delimiter
|
|
143
|
+
function processSingleDelimiter(delimiter) {
|
|
149
144
|
const token = {
|
|
150
145
|
nodeType: LinkType,
|
|
151
146
|
startIndex: delimiter.startIndex,
|
|
152
147
|
endIndex: delimiter.endIndex,
|
|
153
148
|
contentType: delimiter.contentType,
|
|
154
|
-
children: api.resolveFallbackTokens([], delimiter.startIndex + 1, delimiter.endIndex - 1
|
|
149
|
+
children: api.resolveFallbackTokens([], delimiter.startIndex + 1, delimiter.endIndex - 1),
|
|
155
150
|
};
|
|
156
151
|
return [token];
|
|
157
152
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const parse = function (api) {
|
|
156
|
+
return {
|
|
157
|
+
parse: tokens => tokens.map(token => {
|
|
158
|
+
const nodePoints = api.getNodePoints();
|
|
159
|
+
let url = calcStringFromNodePoints(nodePoints, token.startIndex + 1, token.endIndex - 1);
|
|
160
|
+
if (token.contentType === 'email') {
|
|
161
|
+
url = 'mailto:' + url;
|
|
162
|
+
}
|
|
163
|
+
const encodedUrl = encodeLinkDestination(url);
|
|
164
|
+
const children = api.parseInlineTokens(token.children);
|
|
165
|
+
const node = api.shouldReservePosition
|
|
166
|
+
? { type: LinkType, position: api.calcPosition(token), url: encodedUrl, children }
|
|
167
|
+
: { type: LinkType, url: encodedUrl, children };
|
|
168
|
+
return node;
|
|
169
|
+
}),
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const uniqueName = '@yozora/tokenizer-autolink';
|
|
174
|
+
|
|
175
|
+
class AutolinkTokenizer extends BaseInlineTokenizer {
|
|
176
|
+
constructor(props = {}) {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
super({
|
|
179
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
180
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : TokenizerPriority.ATOMIC,
|
|
181
|
+
});
|
|
182
|
+
this.match = match;
|
|
183
|
+
this.parse = parse;
|
|
170
184
|
}
|
|
171
185
|
}
|
|
172
186
|
|
|
173
|
-
export { AutolinkTokenizer, uniqueName as AutolinkTokenizerName, AutolinkTokenizer as default, eatAbsoluteUri, eatAutolinkSchema, eatEmailAddress };
|
|
187
|
+
export { AutolinkTokenizer, uniqueName as AutolinkTokenizerName, match as autolinkMatch, parse as autolinkParse, AutolinkTokenizer as default, eatAbsoluteUri, eatAutolinkSchema, eatEmailAddress };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AutolinkTokenizer } from './tokenizer';
|
|
2
1
|
export * from './util/email';
|
|
3
2
|
export * from './util/uri';
|
|
4
|
-
export {
|
|
3
|
+
export { match as autolinkMatch } from './match';
|
|
4
|
+
export { parse as autolinkParse } from './parse';
|
|
5
|
+
export { AutolinkTokenizer, AutolinkTokenizer as default } from './tokenizer';
|
|
5
6
|
export { uniqueName as AutolinkTokenizerName } from './types';
|
|
6
|
-
export type {
|
|
7
|
-
export default AutolinkTokenizer;
|
|
7
|
+
export type { IThis as IAutolinkHookContext, IToken as IAutolinkToken, ITokenizerProps as IAutolinkTokenizerProps, AutolinkContentType, } from './types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IMatchInlineHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
+
import type { IDelimiter, IThis, IToken, T } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Autolinks are absolute URIs and email addresses inside '<' and '>'.
|
|
5
|
+
* They are parsed as links, with the URL or email address as the link label.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.github.com/gfm/#autolink
|
|
8
|
+
*/
|
|
9
|
+
export declare const match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
package/lib/types/tokenizer.d.ts
CHANGED
|
@@ -1,31 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { NodePoint } from '@yozora/character';
|
|
3
|
-
import type { MatchInlinePhaseApi, ResultOfProcessSingleDelimiter, Tokenizer, TokenizerMatchInlineHook, TokenizerParseInlineHook } from '@yozora/core-tokenizer';
|
|
1
|
+
import type { IInlineTokenizer, IMatchInlineHookCreator, IParseInlineHookCreator } from '@yozora/core-tokenizer';
|
|
4
2
|
import { BaseInlineTokenizer } from '@yozora/core-tokenizer';
|
|
5
|
-
import type {
|
|
3
|
+
import type { IDelimiter, INode, IThis, IToken, ITokenizerProps, T } from './types';
|
|
6
4
|
/**
|
|
7
5
|
* Lexical Analyzer for Autolink.
|
|
8
|
-
*
|
|
9
|
-
* Autolinks are absolute URIs and email addresses inside '<' and '>'.
|
|
10
|
-
* They are parsed as links, with the URL or email address as the link label.
|
|
11
|
-
*
|
|
12
6
|
* @see https://github.github.com/gfm/#autolink
|
|
13
7
|
*/
|
|
14
|
-
export declare class AutolinkTokenizer extends BaseInlineTokenizer<
|
|
15
|
-
constructor(props?:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @see BaseInlineTokenizer
|
|
19
|
-
*/
|
|
20
|
-
protected _findDelimiter(startIndex: number, endIndex: number, nodePoints: ReadonlyArray<NodePoint>): Delimiter | null;
|
|
21
|
-
/**
|
|
22
|
-
* @override
|
|
23
|
-
* @see TokenizerMatchInlineHook
|
|
24
|
-
*/
|
|
25
|
-
processSingleDelimiter(delimiter: Delimiter, nodePoints: ReadonlyArray<NodePoint>, api: Readonly<MatchInlinePhaseApi>): ResultOfProcessSingleDelimiter<T, Token>;
|
|
26
|
-
/**
|
|
27
|
-
* @override
|
|
28
|
-
* @see TokenizerParseInlineHook
|
|
29
|
-
*/
|
|
30
|
-
processToken(token: Token, children: YastNode[] | undefined, nodePoints: ReadonlyArray<NodePoint>): Node;
|
|
8
|
+
export declare class AutolinkTokenizer extends BaseInlineTokenizer<T, IDelimiter, IToken, INode, IThis> implements IInlineTokenizer<T, IDelimiter, IToken, INode, IThis> {
|
|
9
|
+
constructor(props?: ITokenizerProps);
|
|
10
|
+
readonly match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
|
11
|
+
readonly parse: IParseInlineHookCreator<T, IToken, INode, IThis>;
|
|
31
12
|
}
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { ILink, LinkType } from '@yozora/ast';
|
|
2
|
+
import type { INodePoint } from '@yozora/character';
|
|
3
|
+
import type { IBaseInlineTokenizerProps, IPartialYastInlineToken, IResultOfRequiredEater, ITokenizer, IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
4
4
|
export declare type AutolinkContentType = 'uri' | 'email';
|
|
5
5
|
export declare type T = LinkType;
|
|
6
|
-
export declare type
|
|
6
|
+
export declare type INode = ILink;
|
|
7
7
|
export declare const uniqueName = "@yozora/tokenizer-autolink";
|
|
8
|
-
export interface
|
|
8
|
+
export interface IToken extends IPartialYastInlineToken<T> {
|
|
9
9
|
/**
|
|
10
10
|
* Autolink content type: absolute uri or email.
|
|
11
11
|
*/
|
|
12
12
|
contentType: AutolinkContentType;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface IDelimiter extends IYastTokenDelimiter {
|
|
15
15
|
type: 'full';
|
|
16
16
|
/**
|
|
17
17
|
* Autolink content type: absolute uri or email.
|
|
18
18
|
*/
|
|
19
19
|
contentType: AutolinkContentType;
|
|
20
20
|
}
|
|
21
|
-
export declare type
|
|
22
|
-
export declare type
|
|
23
|
-
export
|
|
21
|
+
export declare type IThis = ITokenizer;
|
|
22
|
+
export declare type ITokenizerProps = Partial<IBaseInlineTokenizerProps>;
|
|
23
|
+
export declare type ContentEater = (nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number) => IResultOfRequiredEater;
|
|
24
|
+
export interface IContentHelper {
|
|
24
25
|
contentType: AutolinkContentType;
|
|
25
26
|
eat: ContentEater;
|
|
26
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { INodePoint } from '@yozora/character';
|
|
2
|
+
import type { IResultOfRequiredEater } from '@yozora/core-tokenizer';
|
|
3
3
|
/**
|
|
4
4
|
* An email address, for these purposes, is anything that matches the
|
|
5
5
|
* non-normative regex from the HTML5 spec:
|
|
@@ -9,4 +9,4 @@ import type { ResultOfRequiredEater } from '@yozora/core-tokenizer';
|
|
|
9
9
|
*
|
|
10
10
|
* @see https://github.github.com/gfm/#email-address
|
|
11
11
|
*/
|
|
12
|
-
export declare function eatEmailAddress(nodePoints: ReadonlyArray<
|
|
12
|
+
export declare function eatEmailAddress(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IResultOfRequiredEater;
|
package/lib/types/util/uri.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { INodePoint } from '@yozora/character';
|
|
2
|
+
import type { IResultOfRequiredEater } from '@yozora/core-tokenizer';
|
|
3
3
|
/**
|
|
4
4
|
* Try to find to autolink absolute uri strictly start from the give `startIndex`.
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@ import type { ResultOfRequiredEater } from '@yozora/core-tokenizer';
|
|
|
10
10
|
*
|
|
11
11
|
* @see https://github.github.com/gfm/#absolute-uri
|
|
12
12
|
*/
|
|
13
|
-
export declare function eatAbsoluteUri(nodePoints: ReadonlyArray<
|
|
13
|
+
export declare function eatAbsoluteUri(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IResultOfRequiredEater;
|
|
14
14
|
/**
|
|
15
15
|
* Try to find to autolink schema strictly start from the give `startIndex`.
|
|
16
16
|
*
|
|
@@ -20,4 +20,4 @@ export declare function eatAbsoluteUri(nodePoints: ReadonlyArray<NodePoint>, sta
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://github.github.com/gfm/#scheme
|
|
22
22
|
*/
|
|
23
|
-
export declare function eatAutolinkSchema(nodePoints: ReadonlyArray<
|
|
23
|
+
export declare function eatAutolinkSchema(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IResultOfRequiredEater;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-autolink",
|
|
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
|
}
|