@yozora/tokenizer-link 2.0.2-alpha.0 → 2.0.3
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/LICENSE +1 -1
- package/README.md +45 -45
- package/lib/types/index.d.ts +86 -6
- package/package.json +8 -8
- package/lib/types/match.d.ts +0 -31
- package/lib/types/parse.d.ts +0 -3
- package/lib/types/tokenizer.d.ts +0 -13
- package/lib/types/types.d.ts +0 -32
- package/lib/types/util/check-brackets.d.ts +0 -12
- package/lib/types/util/link-destination.d.ts +0 -15
- package/lib/types/util/link-title.d.ts +0 -14
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020-
|
|
3
|
+
Copyright (c) 2020-2022 guanghechen (me.guanghechen@gmail.com)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<header>
|
|
4
4
|
<h1 align="center">
|
|
5
|
-
<a href="https://github.com/yozorajs/yozora/tree/
|
|
5
|
+
<a href="https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/link#readme">@yozora/tokenizer-link</a>
|
|
6
6
|
</h1>
|
|
7
7
|
<div align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/@yozora/tokenizer-link">
|
|
@@ -188,53 +188,53 @@ Name | Type | Required | Default
|
|
|
188
188
|
|
|
189
189
|
[live-examples]: https://yozora.guanghechen.com/docs/package/tokenizer-link#live-examples
|
|
190
190
|
[docpage]: https://yozora.guanghechen.com/docs/package/tokenizer-link
|
|
191
|
-
[homepage]: https://github.com/yozorajs/yozora/tree/
|
|
191
|
+
[homepage]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/link#readme
|
|
192
192
|
[gfm-spec]: https://github.github.com/gfm
|
|
193
193
|
[mdast-homepage]: https://github.com/syntax-tree/mdast
|
|
194
194
|
|
|
195
|
-
[@yozora/ast]: https://github.com/yozorajs/yozora/tree/
|
|
196
|
-
[@yozora/ast-util]: https://github.com/yozorajs/yozora/tree/
|
|
197
|
-
[@yozora/character]: https://github.com/yozorajs/yozora/tree/
|
|
198
|
-
[@yozora/eslint-config]: https://github.com/yozorajs/yozora/tree/
|
|
199
|
-
[@yozora/core-parser]: https://github.com/yozorajs/yozora/tree/
|
|
200
|
-
[@yozora/core-tokenizer]: https://github.com/yozorajs/yozora/tree/
|
|
201
|
-
[@yozora/invariant]: https://github.com/yozorajs/yozora/tree/
|
|
202
|
-
[@yozora/jest-for-tokenizer]: https://github.com/yozorajs/yozora/tree/
|
|
203
|
-
[@yozora/parser]: https://github.com/yozorajs/yozora/tree/
|
|
204
|
-
[@yozora/parser-gfm]: https://github.com/yozorajs/yozora/tree/
|
|
205
|
-
[@yozora/parser-gfm-ex]: https://github.com/yozorajs/yozora/tree/
|
|
206
|
-
[@yozora/template-tokenizer]: https://github.com/yozorajs/yozora/tree/
|
|
207
|
-
[@yozora/tokenizer-admonition]: https://github.com/yozorajs/yozora/tree/
|
|
208
|
-
[@yozora/tokenizer-autolink]: https://github.com/yozorajs/yozora/tree/
|
|
209
|
-
[@yozora/tokenizer-autolink-extension]: https://github.com/yozorajs/yozora/tree/
|
|
210
|
-
[@yozora/tokenizer-blockquote]: https://github.com/yozorajs/yozora/tree/
|
|
211
|
-
[@yozora/tokenizer-break]: https://github.com/yozorajs/yozora/tree/
|
|
212
|
-
[@yozora/tokenizer-definition]: https://github.com/yozorajs/yozora/tree/
|
|
213
|
-
[@yozora/tokenizer-delete]: https://github.com/yozorajs/yozora/tree/
|
|
214
|
-
[@yozora/tokenizer-ecma-import]: https://github.com/yozorajs/yozora/tree/
|
|
215
|
-
[@yozora/tokenizer-emphasis]: https://github.com/yozorajs/yozora/tree/
|
|
216
|
-
[@yozora/tokenizer-fenced-block]: https://github.com/yozorajs/yozora/tree/
|
|
217
|
-
[@yozora/tokenizer-fenced-code]: https://github.com/yozorajs/yozora/tree/
|
|
218
|
-
[@yozora/tokenizer-footnote]: https://github.com/yozorajs/yozora/tree/
|
|
219
|
-
[@yozora/tokenizer-footnote-definition]: https://github.com/yozorajs/yozora/tree/
|
|
220
|
-
[@yozora/tokenizer-footnote-reference]: https://github.com/yozorajs/yozora/tree/
|
|
221
|
-
[@yozora/tokenizer-heading]: https://github.com/yozorajs/yozora/tree/
|
|
222
|
-
[@yozora/tokenizer-html-block]: https://github.com/yozorajs/yozora/tree/
|
|
223
|
-
[@yozora/tokenizer-html-inline]: https://github.com/yozorajs/yozora/tree/
|
|
224
|
-
[@yozora/tokenizer-image]: https://github.com/yozorajs/yozora/tree/
|
|
225
|
-
[@yozora/tokenizer-image-reference]: https://github.com/yozorajs/yozora/tree/
|
|
226
|
-
[@yozora/tokenizer-indented-code]: https://github.com/yozorajs/yozora/tree/
|
|
227
|
-
[@yozora/tokenizer-inline-code]: https://github.com/yozorajs/yozora/tree/
|
|
228
|
-
[@yozora/tokenizer-inline-math]: https://github.com/yozorajs/yozora/tree/
|
|
229
|
-
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/
|
|
230
|
-
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/
|
|
231
|
-
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/
|
|
232
|
-
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/
|
|
233
|
-
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/
|
|
234
|
-
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/
|
|
235
|
-
[@yozora/tokenizer-table]: https://github.com/yozorajs/yozora/tree/
|
|
236
|
-
[@yozora/tokenizer-text]: https://github.com/yozorajs/yozora/tree/
|
|
237
|
-
[@yozora/tokenizer-thematic-break]: https://github.com/yozorajs/yozora/tree/
|
|
195
|
+
[@yozora/ast]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/ast#readme
|
|
196
|
+
[@yozora/ast-util]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/ast-util#readme
|
|
197
|
+
[@yozora/character]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/character#readme
|
|
198
|
+
[@yozora/eslint-config]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/eslint-config#readme
|
|
199
|
+
[@yozora/core-parser]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/core-parser#readme
|
|
200
|
+
[@yozora/core-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/core-tokenizer#readme
|
|
201
|
+
[@yozora/invariant]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/invariant#readme
|
|
202
|
+
[@yozora/jest-for-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/jest-for-tokenizer#readme
|
|
203
|
+
[@yozora/parser]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/parser#readme
|
|
204
|
+
[@yozora/parser-gfm]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/parser-gfm#readme
|
|
205
|
+
[@yozora/parser-gfm-ex]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/parser-gfm-ex#readme
|
|
206
|
+
[@yozora/template-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/template-tokenizer#readme
|
|
207
|
+
[@yozora/tokenizer-admonition]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/admonition#readme
|
|
208
|
+
[@yozora/tokenizer-autolink]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/autolink#readme
|
|
209
|
+
[@yozora/tokenizer-autolink-extension]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/autolink-extension#readme
|
|
210
|
+
[@yozora/tokenizer-blockquote]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/blockquote#readme
|
|
211
|
+
[@yozora/tokenizer-break]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/break#readme
|
|
212
|
+
[@yozora/tokenizer-definition]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/definition#readme
|
|
213
|
+
[@yozora/tokenizer-delete]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/delete#readme
|
|
214
|
+
[@yozora/tokenizer-ecma-import]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/ecma-import#readme
|
|
215
|
+
[@yozora/tokenizer-emphasis]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/emphasis#readme
|
|
216
|
+
[@yozora/tokenizer-fenced-block]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/fenced-block#readme
|
|
217
|
+
[@yozora/tokenizer-fenced-code]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/fenced-code#readme
|
|
218
|
+
[@yozora/tokenizer-footnote]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/footnote#readme
|
|
219
|
+
[@yozora/tokenizer-footnote-definition]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/footnote-definition#readme
|
|
220
|
+
[@yozora/tokenizer-footnote-reference]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/footnote-reference#readme
|
|
221
|
+
[@yozora/tokenizer-heading]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/heading#readme
|
|
222
|
+
[@yozora/tokenizer-html-block]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/html-block#readme
|
|
223
|
+
[@yozora/tokenizer-html-inline]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/html-inline#readme
|
|
224
|
+
[@yozora/tokenizer-image]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/image#readme
|
|
225
|
+
[@yozora/tokenizer-image-reference]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/image-reference#readme
|
|
226
|
+
[@yozora/tokenizer-indented-code]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/indented-code#readme
|
|
227
|
+
[@yozora/tokenizer-inline-code]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/inline-code#readme
|
|
228
|
+
[@yozora/tokenizer-inline-math]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/inline-math#readme
|
|
229
|
+
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/link#readme
|
|
230
|
+
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/link-reference#readme
|
|
231
|
+
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/list#readme
|
|
232
|
+
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/math#readme
|
|
233
|
+
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/paragraph#readme
|
|
234
|
+
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/setext-heading#readme
|
|
235
|
+
[@yozora/tokenizer-table]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/table#readme
|
|
236
|
+
[@yozora/tokenizer-text]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/text#readme
|
|
237
|
+
[@yozora/tokenizer-thematic-break]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/thematic-break#readme
|
|
238
238
|
|
|
239
239
|
[@yozora/react-admonition]: https://github.com/yozorajs/yozora-react/tree/main/packages/admonition#readme
|
|
240
240
|
[@yozora/react-blockquote]: https://github.com/yozorajs/yozora-react/tree/main/packages/blockquote#readme
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { INodePoint, INodeInterval } from '@yozora/character';
|
|
2
|
+
import { IYastInlineToken, IPartialYastInlineToken, ITokenizer, IBaseInlineTokenizerProps, IYastTokenDelimiter, BaseInlineTokenizer, IInlineTokenizer, IMatchInlineHookCreator, IParseInlineHookCreator } from '@yozora/core-tokenizer';
|
|
3
|
+
import { LinkType, Link } from '@yozora/ast';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The link text may contain balanced brackets, but not unbalanced ones,
|
|
7
|
+
* unless they are escaped
|
|
8
|
+
*
|
|
9
|
+
* @see https://github.github.com/gfm/#example-520
|
|
10
|
+
* @see https://github.github.com/gfm/#example-521
|
|
11
|
+
* @see https://github.github.com/gfm/#example-522
|
|
12
|
+
* @see https://github.github.com/gfm/#example-523
|
|
13
|
+
*/
|
|
14
|
+
declare const checkBalancedBracketsStatus: (startIndex: number, endIndex: number, internalTokens: ReadonlyArray<IYastInlineToken>, nodePoints: ReadonlyArray<INodePoint>) => -1 | 0 | 1;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A link destination consists of either
|
|
18
|
+
* - a sequence of zero or more characters between an opening '<' and a closing '>'
|
|
19
|
+
* that contains no line breaks or unescaped '<' or '>' characters, or
|
|
20
|
+
* - a nonempty sequence of characters that does not start with '<', does not include
|
|
21
|
+
* ASCII space or control characters, and includes parentheses only if
|
|
22
|
+
* (a) they are backslash-escaped or
|
|
23
|
+
* (b) they are part of a balanced pair of unescaped parentheses. (Implementations
|
|
24
|
+
* may impose limits on parentheses nesting to avoid performance issues, but
|
|
25
|
+
* at least three levels of nesting should be supported.)
|
|
26
|
+
* @see https://github.github.com/gfm/#link-destination
|
|
27
|
+
* @return position at next iteration
|
|
28
|
+
*/
|
|
29
|
+
declare function eatLinkDestination(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A link title consists of either
|
|
33
|
+
*
|
|
34
|
+
* - a sequence of zero or more characters between straight double-quote
|
|
35
|
+
* characters '"', including a '"' character only if it is backslash-escaped, or
|
|
36
|
+
*
|
|
37
|
+
* - a sequence of zero or more characters between straight single-quote
|
|
38
|
+
* characters '\'', including a '\'' character only if it is backslash-escaped, or
|
|
39
|
+
*
|
|
40
|
+
* - a sequence of zero or more characters between matching parentheses '(...)',
|
|
41
|
+
* including a '(' or ')' character only if it is backslash-escaped.
|
|
42
|
+
*/
|
|
43
|
+
declare function eatLinkTitle(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number;
|
|
44
|
+
|
|
45
|
+
declare type T = LinkType;
|
|
46
|
+
declare type INode = Link;
|
|
47
|
+
declare const uniqueName = "@yozora/tokenizer-link";
|
|
48
|
+
interface IToken extends IPartialYastInlineToken<T> {
|
|
49
|
+
/**
|
|
50
|
+
* Link destination interval.
|
|
51
|
+
*/
|
|
52
|
+
destinationContent?: INodeInterval;
|
|
53
|
+
/**
|
|
54
|
+
* Link title interval.
|
|
55
|
+
*/
|
|
56
|
+
titleContent?: INodeInterval;
|
|
57
|
+
}
|
|
58
|
+
interface IDelimiter extends IYastTokenDelimiter {
|
|
59
|
+
/**
|
|
60
|
+
* IDelimiter type.
|
|
61
|
+
*/
|
|
62
|
+
type: 'opener' | 'closer';
|
|
63
|
+
/**
|
|
64
|
+
* Link destination interval.
|
|
65
|
+
*/
|
|
66
|
+
destinationContent?: INodeInterval;
|
|
67
|
+
/**
|
|
68
|
+
* Link title interval.
|
|
69
|
+
*/
|
|
70
|
+
titleContent?: INodeInterval;
|
|
71
|
+
}
|
|
72
|
+
declare type IThis = ITokenizer;
|
|
73
|
+
declare type ITokenizerProps = Partial<IBaseInlineTokenizerProps>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Lexical Analyzer for InlineLink.
|
|
77
|
+
* @see https://github.com/syntax-tree/mdast#link
|
|
78
|
+
* @see https://github.github.com/gfm/#links
|
|
79
|
+
*/
|
|
80
|
+
declare class LinkTokenizer extends BaseInlineTokenizer<T, IDelimiter, IToken, INode, IThis> implements IInlineTokenizer<T, IDelimiter, IToken, INode, IThis> {
|
|
81
|
+
constructor(props?: ITokenizerProps);
|
|
82
|
+
readonly match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
|
83
|
+
readonly parse: IParseInlineHookCreator<T, IToken, INode, IThis>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { IThis as ILinkHookContext, IToken as ILinkToken, ITokenizerProps as ILinkTokenizerProps, LinkTokenizer, uniqueName as LinkTokenizerName, checkBalancedBracketsStatus, LinkTokenizer as default, eatLinkDestination, eatLinkTitle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-link",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"url": "https://github.com/yozorajs/yozora.git",
|
|
11
11
|
"directory": "tokenizers/link"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/link",
|
|
14
14
|
"main": "lib/cjs/index.js",
|
|
15
15
|
"module": "lib/esm/index.js",
|
|
16
16
|
"types": "lib/types/index.d.ts",
|
|
17
17
|
"source": "src/index.ts",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">= 16.0.0"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"lib/",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.js",
|
|
33
|
-
"prebuild": "rimraf lib/
|
|
33
|
+
"prebuild": "rimraf lib/",
|
|
34
34
|
"prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build",
|
|
35
35
|
"test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yozora/ast": "^2.0.
|
|
39
|
-
"@yozora/character": "^2.0.
|
|
40
|
-
"@yozora/core-tokenizer": "^2.0.
|
|
38
|
+
"@yozora/ast": "^2.0.3",
|
|
39
|
+
"@yozora/character": "^2.0.3",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "8cc8f95cfebc8d752bc3272cdd24965f540c130b"
|
|
43
43
|
}
|
package/lib/types/match.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { IMatchInlineHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
-
import type { IDelimiter, IThis, IToken, T } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* An inline link consists of a link text followed immediately by a left
|
|
5
|
-
* parenthesis '(', optional whitespace, an optional link destination, an
|
|
6
|
-
* optional link title separated from the link destination by whitespace,
|
|
7
|
-
* optional whitespace, and a right parenthesis ')'. The link’s text consists
|
|
8
|
-
* of the inlines contained in the link text (excluding the enclosing square
|
|
9
|
-
* brackets).
|
|
10
|
-
* The link’s URI consists of the link destination, excluding enclosing '<...>'
|
|
11
|
-
* if present, with backslash-escapes in effect as described above. The link’s
|
|
12
|
-
* title consists of the link title, excluding its enclosing delimiters, with
|
|
13
|
-
* backslash-escapes in effect as described above.
|
|
14
|
-
*
|
|
15
|
-
* ------
|
|
16
|
-
*
|
|
17
|
-
* A 'opener' type delimiter is one of the following forms:
|
|
18
|
-
*
|
|
19
|
-
* - '['
|
|
20
|
-
*
|
|
21
|
-
* A 'closer' type delimiter is one of the following forms:
|
|
22
|
-
*
|
|
23
|
-
* - '](url)'
|
|
24
|
-
* - '](url "title")'
|
|
25
|
-
* - '](<url>)'
|
|
26
|
-
* - '](<url> "title")'
|
|
27
|
-
*
|
|
28
|
-
* @see https://github.com/syntax-tree/mdast#link
|
|
29
|
-
* @see https://github.github.com/gfm/#links
|
|
30
|
-
*/
|
|
31
|
-
export declare const match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
package/lib/types/parse.d.ts
DELETED
package/lib/types/tokenizer.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IInlineTokenizer, IMatchInlineHookCreator, IParseInlineHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
-
import { BaseInlineTokenizer } from '@yozora/core-tokenizer';
|
|
3
|
-
import type { IDelimiter, INode, IThis, IToken, ITokenizerProps, T } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Lexical Analyzer for InlineLink.
|
|
6
|
-
* @see https://github.com/syntax-tree/mdast#link
|
|
7
|
-
* @see https://github.github.com/gfm/#links
|
|
8
|
-
*/
|
|
9
|
-
export declare class LinkTokenizer extends BaseInlineTokenizer<T, IDelimiter, IToken, INode, IThis> implements IInlineTokenizer<T, IDelimiter, IToken, INode, IThis> {
|
|
10
|
-
constructor(props?: ITokenizerProps);
|
|
11
|
-
readonly match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
|
12
|
-
readonly parse: IParseInlineHookCreator<T, IToken, INode, IThis>;
|
|
13
|
-
}
|
package/lib/types/types.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Link, LinkType } from '@yozora/ast';
|
|
2
|
-
import type { INodeInterval } from '@yozora/character';
|
|
3
|
-
import type { IBaseInlineTokenizerProps, IPartialYastInlineToken, ITokenizer, IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
4
|
-
export declare type T = LinkType;
|
|
5
|
-
export declare type INode = Link;
|
|
6
|
-
export declare const uniqueName = "@yozora/tokenizer-link";
|
|
7
|
-
export interface IToken extends IPartialYastInlineToken<T> {
|
|
8
|
-
/**
|
|
9
|
-
* Link destination interval.
|
|
10
|
-
*/
|
|
11
|
-
destinationContent?: INodeInterval;
|
|
12
|
-
/**
|
|
13
|
-
* Link title interval.
|
|
14
|
-
*/
|
|
15
|
-
titleContent?: INodeInterval;
|
|
16
|
-
}
|
|
17
|
-
export interface IDelimiter extends IYastTokenDelimiter {
|
|
18
|
-
/**
|
|
19
|
-
* IDelimiter type.
|
|
20
|
-
*/
|
|
21
|
-
type: 'opener' | 'closer';
|
|
22
|
-
/**
|
|
23
|
-
* Link destination interval.
|
|
24
|
-
*/
|
|
25
|
-
destinationContent?: INodeInterval;
|
|
26
|
-
/**
|
|
27
|
-
* Link title interval.
|
|
28
|
-
*/
|
|
29
|
-
titleContent?: INodeInterval;
|
|
30
|
-
}
|
|
31
|
-
export declare type IThis = ITokenizer;
|
|
32
|
-
export declare type ITokenizerProps = Partial<IBaseInlineTokenizerProps>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { INodePoint } from '@yozora/character';
|
|
2
|
-
import type { IYastInlineToken } from '@yozora/core-tokenizer';
|
|
3
|
-
/**
|
|
4
|
-
* The link text may contain balanced brackets, but not unbalanced ones,
|
|
5
|
-
* unless they are escaped
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.github.com/gfm/#example-520
|
|
8
|
-
* @see https://github.github.com/gfm/#example-521
|
|
9
|
-
* @see https://github.github.com/gfm/#example-522
|
|
10
|
-
* @see https://github.github.com/gfm/#example-523
|
|
11
|
-
*/
|
|
12
|
-
export declare const checkBalancedBracketsStatus: (startIndex: number, endIndex: number, internalTokens: ReadonlyArray<IYastInlineToken>, nodePoints: ReadonlyArray<INodePoint>) => -1 | 0 | 1;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { INodePoint } from '@yozora/character';
|
|
2
|
-
/**
|
|
3
|
-
* A link destination consists of either
|
|
4
|
-
* - a sequence of zero or more characters between an opening '<' and a closing '>'
|
|
5
|
-
* that contains no line breaks or unescaped '<' or '>' characters, or
|
|
6
|
-
* - a nonempty sequence of characters that does not start with '<', does not include
|
|
7
|
-
* ASCII space or control characters, and includes parentheses only if
|
|
8
|
-
* (a) they are backslash-escaped or
|
|
9
|
-
* (b) they are part of a balanced pair of unescaped parentheses. (Implementations
|
|
10
|
-
* may impose limits on parentheses nesting to avoid performance issues, but
|
|
11
|
-
* at least three levels of nesting should be supported.)
|
|
12
|
-
* @see https://github.github.com/gfm/#link-destination
|
|
13
|
-
* @return position at next iteration
|
|
14
|
-
*/
|
|
15
|
-
export declare function eatLinkDestination(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { INodePoint } from '@yozora/character';
|
|
2
|
-
/**
|
|
3
|
-
* A link title consists of either
|
|
4
|
-
*
|
|
5
|
-
* - a sequence of zero or more characters between straight double-quote
|
|
6
|
-
* characters '"', including a '"' character only if it is backslash-escaped, or
|
|
7
|
-
*
|
|
8
|
-
* - a sequence of zero or more characters between straight single-quote
|
|
9
|
-
* characters '\'', including a '\'' character only if it is backslash-escaped, or
|
|
10
|
-
*
|
|
11
|
-
* - a sequence of zero or more characters between matching parentheses '(...)',
|
|
12
|
-
* including a '(' or ')' character only if it is backslash-escaped.
|
|
13
|
-
*/
|
|
14
|
-
export declare function eatLinkTitle(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): number;
|