|
1 | 1 | /**
|
2 | 2 | * @typedef {import('mdast').Link} Link
|
| 3 | + * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext |
3 | 4 | * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
|
4 | 5 | * @typedef {import('mdast-util-from-markdown').Transform} FromMarkdownTransform
|
5 | 6 | * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
|
@@ -41,47 +42,74 @@ export const gfmAutolinkLiteralToMarkdown = {
|
41 | 42 | before: '[+\\-.\\w]',
|
42 | 43 | after: '[\\-.\\w]',
|
43 | 44 | inConstruct,
|
| 45 | + // @ts-expect-error: to do: use map. |
44 | 46 | notInConstruct
|
45 | 47 | },
|
46 | 48 | {
|
47 | 49 | character: '.',
|
48 | 50 | before: '[Ww]',
|
49 | 51 | after: '[\\-.\\w]',
|
50 | 52 | inConstruct,
|
| 53 | + // @ts-expect-error: to do: use map. |
51 | 54 | notInConstruct
|
52 | 55 | },
|
53 |
| - {character: ':', before: '[ps]', after: '\\/', inConstruct, notInConstruct} |
| 56 | + { |
| 57 | + character: ':', |
| 58 | + before: '[ps]', |
| 59 | + after: '\\/', |
| 60 | + inConstruct, |
| 61 | + // @ts-expect-error: to do: use map. |
| 62 | + notInConstruct |
| 63 | + } |
54 | 64 | ]
|
55 | 65 | }
|
56 | 66 |
|
57 |
| -/** @type {FromMarkdownHandle} */ |
| 67 | +/** |
| 68 | + * @this {CompileContext} |
| 69 | + * @type {FromMarkdownHandle} |
| 70 | + */ |
58 | 71 | function enterLiteralAutolink(token) {
|
59 | 72 | this.enter({type: 'link', title: null, url: '', children: []}, token)
|
60 | 73 | }
|
61 | 74 |
|
62 |
| -/** @type {FromMarkdownHandle} */ |
| 75 | +/** |
| 76 | + * @this {CompileContext} |
| 77 | + * @type {FromMarkdownHandle} |
| 78 | + */ |
63 | 79 | function enterLiteralAutolinkValue(token) {
|
64 | 80 | this.config.enter.autolinkProtocol.call(this, token)
|
65 | 81 | }
|
66 | 82 |
|
67 |
| -/** @type {FromMarkdownHandle} */ |
| 83 | +/** |
| 84 | + * @this {CompileContext} |
| 85 | + * @type {FromMarkdownHandle} |
| 86 | + */ |
68 | 87 | function exitLiteralAutolinkHttp(token) {
|
69 | 88 | this.config.exit.autolinkProtocol.call(this, token)
|
70 | 89 | }
|
71 | 90 |
|
72 |
| -/** @type {FromMarkdownHandle} */ |
| 91 | +/** |
| 92 | + * @this {CompileContext} |
| 93 | + * @type {FromMarkdownHandle} |
| 94 | + */ |
73 | 95 | function exitLiteralAutolinkWww(token) {
|
74 | 96 | this.config.exit.data.call(this, token)
|
75 | 97 | const node = /** @type {Link} */ (this.stack[this.stack.length - 1])
|
76 | 98 | node.url = 'http://' + this.sliceSerialize(token)
|
77 | 99 | }
|
78 | 100 |
|
79 |
| -/** @type {FromMarkdownHandle} */ |
| 101 | +/** |
| 102 | + * @this {CompileContext} |
| 103 | + * @type {FromMarkdownHandle} |
| 104 | + */ |
80 | 105 | function exitLiteralAutolinkEmail(token) {
|
81 | 106 | this.config.exit.autolinkEmail.call(this, token)
|
82 | 107 | }
|
83 | 108 |
|
84 |
| -/** @type {FromMarkdownHandle} */ |
| 109 | +/** |
| 110 | + * @this {CompileContext} |
| 111 | + * @type {FromMarkdownHandle} |
| 112 | + */ |
85 | 113 | function exitLiteralAutolink(token) {
|
86 | 114 | this.exit(token)
|
87 | 115 | }
|
|
0 commit comments