@yozora/tokenizer-html-inline 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 +196 -11
- package/package.json +9 -9
- package/lib/types/match.d.ts +0 -11
- package/lib/types/parse.d.ts +0 -3
- package/lib/types/tokenizer.d.ts +0 -18
- package/lib/types/types.d.ts +0 -23
- package/lib/types/util/cdata.d.ts +0 -21
- package/lib/types/util/closing.d.ts +0 -23
- package/lib/types/util/comment.d.ts +0 -21
- package/lib/types/util/declaration.d.ts +0 -23
- package/lib/types/util/instruction.d.ts +0 -25
- package/lib/types/util/open.d.ts +0 -40
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/html-inline#readme">@yozora/tokenizer-html-inline</a>
|
|
6
6
|
</h1>
|
|
7
7
|
<div align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/@yozora/tokenizer-html-inline">
|
|
@@ -188,53 +188,53 @@ Name | Type | Required | Default
|
|
|
188
188
|
|
|
189
189
|
[live-examples]: https://yozora.guanghechen.com/docs/package/tokenizer-html-inline#live-examples
|
|
190
190
|
[docpage]: https://yozora.guanghechen.com/docs/package/tokenizer-html-inline
|
|
191
|
-
[homepage]: https://github.com/yozorajs/yozora/tree/
|
|
191
|
+
[homepage]: https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/html-inline#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,11 +1,196 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { INodePoint, INodeInterval } from '@yozora/character';
|
|
2
|
+
import { IYastTokenDelimiter, IPartialYastInlineToken, ITokenizer, IBaseInlineTokenizerProps, IMatchInlineHookCreator, IParseInlineHookCreator, BaseInlineTokenizer, IInlineTokenizer } from '@yozora/core-tokenizer';
|
|
3
|
+
import { RawHTMLAttribute } from '@yozora/tokenizer-html-block';
|
|
4
|
+
import { HtmlType, Html } from '@yozora/ast';
|
|
5
|
+
|
|
6
|
+
interface IHtmlInlineCDataData {
|
|
7
|
+
htmlType: 'cdata';
|
|
8
|
+
}
|
|
9
|
+
interface IHtmlInlineCDataTokenData {
|
|
10
|
+
htmlType: 'cdata';
|
|
11
|
+
}
|
|
12
|
+
interface IHtmlInlineCDataDelimiter extends IYastTokenDelimiter, IHtmlInlineCDataTokenData {
|
|
13
|
+
type: 'full';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A CDATA section consists of the string `<![CDATA[`, a string of characters
|
|
17
|
+
* not including the string `]]>`, and the string `]]>`.
|
|
18
|
+
*
|
|
19
|
+
* @param nodePoints
|
|
20
|
+
* @param startIndex
|
|
21
|
+
* @param endIndex
|
|
22
|
+
* @see https://github.github.com/gfm/#cdata-section
|
|
23
|
+
*/
|
|
24
|
+
declare function eatHtmlInlineCDataDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineCDataDelimiter | null;
|
|
25
|
+
|
|
26
|
+
interface IHtmlInlineClosingTagData {
|
|
27
|
+
htmlType: 'closing';
|
|
28
|
+
tagName: string;
|
|
29
|
+
}
|
|
30
|
+
interface IHtmlInlineClosingTokenData {
|
|
31
|
+
htmlType: 'closing';
|
|
32
|
+
tagName: INodeInterval;
|
|
33
|
+
}
|
|
34
|
+
interface IHtmlInlineClosingDelimiter extends IYastTokenDelimiter, IHtmlInlineClosingTokenData {
|
|
35
|
+
type: 'full';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A closing tag consists of the string '</', a tag name, optional whitespace,
|
|
39
|
+
* and the character '>'.
|
|
40
|
+
*
|
|
41
|
+
* @param nodePoints
|
|
42
|
+
* @param startIndex
|
|
43
|
+
* @param endIndex
|
|
44
|
+
* @see https://github.github.com/gfm/#closing-tag
|
|
45
|
+
*/
|
|
46
|
+
declare function eatHtmlInlineClosingDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineClosingDelimiter | null;
|
|
47
|
+
|
|
48
|
+
interface IHtmlInlineCommentData {
|
|
49
|
+
htmlType: 'comment';
|
|
50
|
+
}
|
|
51
|
+
interface IHtmlInlineCommentTokenData {
|
|
52
|
+
htmlType: 'comment';
|
|
53
|
+
}
|
|
54
|
+
interface IHtmlInlineCommentDelimiter extends IYastTokenDelimiter, IHtmlInlineCommentTokenData {
|
|
55
|
+
type: 'full';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* An HTML comment consists of `<!--` + text + `-->`, where text does not start
|
|
59
|
+
* with `>` or `->`, does not end with `-`, and does not contain `--`.
|
|
60
|
+
*
|
|
61
|
+
* @param nodePoints
|
|
62
|
+
* @param startIndex
|
|
63
|
+
* @param endIndex
|
|
64
|
+
* @see https://github.github.com/gfm/#html-comment
|
|
65
|
+
*/
|
|
66
|
+
declare function eatHtmlInlineCommentDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineCommentDelimiter | null;
|
|
67
|
+
|
|
68
|
+
interface IHtmlInlineDeclarationData {
|
|
69
|
+
htmlType: 'declaration';
|
|
70
|
+
}
|
|
71
|
+
interface IHtmlInlineDeclarationTokenData {
|
|
72
|
+
htmlType: 'declaration';
|
|
73
|
+
tagName: INodeInterval;
|
|
74
|
+
}
|
|
75
|
+
interface IHtmlInlineDeclarationDelimiter extends IYastTokenDelimiter, IHtmlInlineDeclarationTokenData {
|
|
76
|
+
type: 'full';
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A declaration consists of the string `<!`, a name consisting of one or more
|
|
80
|
+
* uppercase ASCII letters, whitespace, a string of characters not including
|
|
81
|
+
* the character `>`, and the character `>`.
|
|
82
|
+
*
|
|
83
|
+
* @param nodePoints
|
|
84
|
+
* @param startIndex
|
|
85
|
+
* @param endIndex
|
|
86
|
+
* @see https://github.github.com/gfm/#declaration
|
|
87
|
+
*/
|
|
88
|
+
declare function eatHtmlInlineDeclarationDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineDeclarationDelimiter | null;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @see https://github.github.com/gfm/#processing-instruction
|
|
93
|
+
*/
|
|
94
|
+
interface IHtmlInlineInstructionData {
|
|
95
|
+
htmlType: 'instruction';
|
|
96
|
+
}
|
|
97
|
+
interface IHtmlInlineInstructionTokenData {
|
|
98
|
+
htmlType: 'instruction';
|
|
99
|
+
}
|
|
100
|
+
interface IHtmlInlineInstructionDelimiter extends IYastTokenDelimiter, IHtmlInlineInstructionTokenData {
|
|
101
|
+
type: 'full';
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A processing instruction consists of the string `<?`, a string of characters
|
|
105
|
+
* not including the string `?>`, and the string `?>`.
|
|
106
|
+
*
|
|
107
|
+
* @param nodePoints
|
|
108
|
+
* @param startIndex
|
|
109
|
+
* @param endIndex
|
|
110
|
+
* @see https://github.github.com/gfm/#processing-instruction
|
|
111
|
+
*/
|
|
112
|
+
declare function eatHtmlInlineInstructionDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineInstructionDelimiter | null;
|
|
113
|
+
|
|
114
|
+
interface IHtmlInlineOpenTagData {
|
|
115
|
+
htmlType: 'open';
|
|
116
|
+
/**
|
|
117
|
+
* HTML tag name.
|
|
118
|
+
*/
|
|
119
|
+
tagName: string;
|
|
120
|
+
/**
|
|
121
|
+
* HTML attributes.
|
|
122
|
+
*/
|
|
123
|
+
attributes: Array<{
|
|
124
|
+
name: string;
|
|
125
|
+
value?: string;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Whether if a html tag is self closed.
|
|
129
|
+
*/
|
|
130
|
+
selfClosed: boolean;
|
|
131
|
+
}
|
|
132
|
+
interface IHtmlInlineOpenTokenData {
|
|
133
|
+
htmlType: 'open';
|
|
134
|
+
tagName: INodeInterval;
|
|
135
|
+
attributes: RawHTMLAttribute[];
|
|
136
|
+
selfClosed: boolean;
|
|
137
|
+
}
|
|
138
|
+
interface IHtmlInlineOpenDelimiter extends IYastTokenDelimiter, IHtmlInlineOpenTokenData {
|
|
139
|
+
type: 'full';
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* An open tag consists of a '<' character, a tag name, zero or more attributes,
|
|
143
|
+
* optional whitespace, an optional '/' character, and a '>' character.
|
|
144
|
+
*
|
|
145
|
+
* @param nodePoints
|
|
146
|
+
* @param startIndex
|
|
147
|
+
* @param endIndex
|
|
148
|
+
* @see https://github.github.com/gfm/#open-tag
|
|
149
|
+
*/
|
|
150
|
+
declare function eatHtmlInlineTokenOpenDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineOpenDelimiter | null;
|
|
151
|
+
|
|
152
|
+
declare type T = HtmlType;
|
|
153
|
+
declare type INode = Html;
|
|
154
|
+
declare const uniqueName = "@yozora/tokenizer-html-inline";
|
|
155
|
+
/**
|
|
156
|
+
* Text between '<' and '>' that looks like an HTML tag is parsed as a raw
|
|
157
|
+
* HTML tag and will be rendered in HTML without escaping. Tag and attribute
|
|
158
|
+
* names are not limited to current HTML tags, so custom tags (and even, say,
|
|
159
|
+
* DocBook tags) may be used.
|
|
160
|
+
*
|
|
161
|
+
* @see https://github.github.com/gfm/#raw-html
|
|
162
|
+
*/
|
|
163
|
+
declare type IToken = IPartialYastInlineToken<T> & (IHtmlInlineOpenTokenData | IHtmlInlineClosingTokenData | IHtmlInlineCommentTokenData | IHtmlInlineInstructionTokenData | IHtmlInlineDeclarationTokenData | IHtmlInlineCDataTokenData);
|
|
164
|
+
declare type IDelimiter = IHtmlInlineOpenDelimiter | IHtmlInlineClosingDelimiter | IHtmlInlineCommentDelimiter | IHtmlInlineInstructionDelimiter | IHtmlInlineDeclarationDelimiter | IHtmlInlineCDataDelimiter;
|
|
165
|
+
declare type IThis = ITokenizer;
|
|
166
|
+
declare type ITokenizerProps = Partial<IBaseInlineTokenizerProps>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Text between '<' and '>' that looks like an HTML tag is parsed as a raw HTML
|
|
170
|
+
* tag and will be rendered in HTML without escaping. Tag and attribute names
|
|
171
|
+
* are not limited to current HTML tags, so custom tags (and even, say, DocBook
|
|
172
|
+
* tags) may be used.
|
|
173
|
+
*
|
|
174
|
+
* @see https://github.github.com/gfm/#raw-html
|
|
175
|
+
*/
|
|
176
|
+
declare const match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
|
177
|
+
|
|
178
|
+
declare const parse: IParseInlineHookCreator<T, IToken, INode, IThis>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Lexical Analyzer for HtmlInline.
|
|
182
|
+
*
|
|
183
|
+
* Text between '<' and '>' that looks like an HTML tag is parsed as a raw HTML
|
|
184
|
+
* tag and will be rendered in HTML without escaping. Tag and attribute names
|
|
185
|
+
* are not limited to current HTML tags, so custom tags (and even, say, DocBook
|
|
186
|
+
* tags) may be used.
|
|
187
|
+
*
|
|
188
|
+
* @see https://github.github.com/gfm/#raw-html
|
|
189
|
+
*/
|
|
190
|
+
declare class HtmlInlineTokenizer extends BaseInlineTokenizer<T, IDelimiter, IToken, INode, IThis> implements IInlineTokenizer<T, IDelimiter, IToken, INode, IThis> {
|
|
191
|
+
constructor(props?: ITokenizerProps);
|
|
192
|
+
readonly match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
|
193
|
+
readonly parse: IParseInlineHookCreator<T, IToken, INode, IThis>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export { HtmlInlineTokenizer, uniqueName as HtmlInlineTokenizerName, IHtmlInlineCDataData, IHtmlInlineCDataDelimiter, IHtmlInlineCDataTokenData, IHtmlInlineClosingDelimiter, IHtmlInlineClosingTagData, IHtmlInlineClosingTokenData, IHtmlInlineCommentData, IHtmlInlineCommentDelimiter, IHtmlInlineCommentTokenData, IHtmlInlineDeclarationData, IHtmlInlineDeclarationDelimiter, IHtmlInlineDeclarationTokenData, IThis as IHtmlInlineHookContext, IHtmlInlineInstructionData, IHtmlInlineInstructionDelimiter, IHtmlInlineInstructionTokenData, IHtmlInlineOpenDelimiter, IHtmlInlineOpenTagData, IHtmlInlineOpenTokenData, IToken as IHtmlInlineToken, ITokenizerProps as IHtmlInlineTokenizerProps, HtmlInlineTokenizer as default, eatHtmlInlineCDataDelimiter, eatHtmlInlineClosingDelimiter, eatHtmlInlineCommentDelimiter, eatHtmlInlineDeclarationDelimiter, eatHtmlInlineInstructionDelimiter, eatHtmlInlineTokenOpenDelimiter, match as htmlInlineMatch, parse as htmlInlineParse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-html-inline",
|
|
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/html-inline"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://github.com/yozorajs/yozora/tree/release-2.x.x/tokenizers/html-inline",
|
|
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,15 +30,15 @@
|
|
|
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.
|
|
41
|
-
"@yozora/tokenizer-html-block": "^2.0.
|
|
38
|
+
"@yozora/ast": "^2.0.3",
|
|
39
|
+
"@yozora/character": "^2.0.3",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.3",
|
|
41
|
+
"@yozora/tokenizer-html-block": "^2.0.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "8cc8f95cfebc8d752bc3272cdd24965f540c130b"
|
|
44
44
|
}
|
package/lib/types/match.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { IMatchInlineHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
-
import type { IDelimiter, IThis, IToken, T } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Text between '<' and '>' that looks like an HTML tag is parsed as a raw HTML
|
|
5
|
-
* tag and will be rendered in HTML without escaping. Tag and attribute names
|
|
6
|
-
* are not limited to current HTML tags, so custom tags (and even, say, DocBook
|
|
7
|
-
* tags) may be used.
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.github.com/gfm/#raw-html
|
|
10
|
-
*/
|
|
11
|
-
export declare const match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
package/lib/types/parse.d.ts
DELETED
package/lib/types/tokenizer.d.ts
DELETED
|
@@ -1,18 +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 HtmlInline.
|
|
6
|
-
*
|
|
7
|
-
* Text between '<' and '>' that looks like an HTML tag is parsed as a raw HTML
|
|
8
|
-
* tag and will be rendered in HTML without escaping. Tag and attribute names
|
|
9
|
-
* are not limited to current HTML tags, so custom tags (and even, say, DocBook
|
|
10
|
-
* tags) may be used.
|
|
11
|
-
*
|
|
12
|
-
* @see https://github.github.com/gfm/#raw-html
|
|
13
|
-
*/
|
|
14
|
-
export declare class HtmlInlineTokenizer extends BaseInlineTokenizer<T, IDelimiter, IToken, INode, IThis> implements IInlineTokenizer<T, IDelimiter, IToken, INode, IThis> {
|
|
15
|
-
constructor(props?: ITokenizerProps);
|
|
16
|
-
readonly match: IMatchInlineHookCreator<T, IDelimiter, IToken, IThis>;
|
|
17
|
-
readonly parse: IParseInlineHookCreator<T, IToken, INode, IThis>;
|
|
18
|
-
}
|
package/lib/types/types.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Html, HtmlType } from '@yozora/ast';
|
|
2
|
-
import type { IBaseInlineTokenizerProps, IPartialYastInlineToken, ITokenizer } from '@yozora/core-tokenizer';
|
|
3
|
-
import type { IHtmlInlineCDataDelimiter, IHtmlInlineCDataTokenData } from './util/cdata';
|
|
4
|
-
import type { IHtmlInlineClosingDelimiter, IHtmlInlineClosingTokenData } from './util/closing';
|
|
5
|
-
import type { IHtmlInlineCommentDelimiter, IHtmlInlineCommentTokenData } from './util/comment';
|
|
6
|
-
import type { IHtmlInlineDeclarationDelimiter, IHtmlInlineDeclarationTokenData } from './util/declaration';
|
|
7
|
-
import type { IHtmlInlineInstructionDelimiter, IHtmlInlineInstructionTokenData } from './util/instruction';
|
|
8
|
-
import type { IHtmlInlineOpenDelimiter, IHtmlInlineOpenTokenData as IHtmlInlineOpenTokenData } from './util/open';
|
|
9
|
-
export declare type T = HtmlType;
|
|
10
|
-
export declare type INode = Html;
|
|
11
|
-
export declare const uniqueName = "@yozora/tokenizer-html-inline";
|
|
12
|
-
/**
|
|
13
|
-
* Text between '<' and '>' that looks like an HTML tag is parsed as a raw
|
|
14
|
-
* HTML tag and will be rendered in HTML without escaping. Tag and attribute
|
|
15
|
-
* names are not limited to current HTML tags, so custom tags (and even, say,
|
|
16
|
-
* DocBook tags) may be used.
|
|
17
|
-
*
|
|
18
|
-
* @see https://github.github.com/gfm/#raw-html
|
|
19
|
-
*/
|
|
20
|
-
export declare type IToken = IPartialYastInlineToken<T> & (IHtmlInlineOpenTokenData | IHtmlInlineClosingTokenData | IHtmlInlineCommentTokenData | IHtmlInlineInstructionTokenData | IHtmlInlineDeclarationTokenData | IHtmlInlineCDataTokenData);
|
|
21
|
-
export declare type IDelimiter = IHtmlInlineOpenDelimiter | IHtmlInlineClosingDelimiter | IHtmlInlineCommentDelimiter | IHtmlInlineInstructionDelimiter | IHtmlInlineDeclarationDelimiter | IHtmlInlineCDataDelimiter;
|
|
22
|
-
export declare type IThis = ITokenizer;
|
|
23
|
-
export declare type ITokenizerProps = Partial<IBaseInlineTokenizerProps>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { INodePoint } from '@yozora/character';
|
|
2
|
-
import type { IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
3
|
-
export interface IHtmlInlineCDataData {
|
|
4
|
-
htmlType: 'cdata';
|
|
5
|
-
}
|
|
6
|
-
export interface IHtmlInlineCDataTokenData {
|
|
7
|
-
htmlType: 'cdata';
|
|
8
|
-
}
|
|
9
|
-
export interface IHtmlInlineCDataDelimiter extends IYastTokenDelimiter, IHtmlInlineCDataTokenData {
|
|
10
|
-
type: 'full';
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A CDATA section consists of the string `<![CDATA[`, a string of characters
|
|
14
|
-
* not including the string `]]>`, and the string `]]>`.
|
|
15
|
-
*
|
|
16
|
-
* @param nodePoints
|
|
17
|
-
* @param startIndex
|
|
18
|
-
* @param endIndex
|
|
19
|
-
* @see https://github.github.com/gfm/#cdata-section
|
|
20
|
-
*/
|
|
21
|
-
export declare function eatHtmlInlineCDataDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineCDataDelimiter | null;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { INodeInterval, INodePoint } from '@yozora/character';
|
|
2
|
-
import type { IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
3
|
-
export interface IHtmlInlineClosingTagData {
|
|
4
|
-
htmlType: 'closing';
|
|
5
|
-
tagName: string;
|
|
6
|
-
}
|
|
7
|
-
export interface IHtmlInlineClosingTokenData {
|
|
8
|
-
htmlType: 'closing';
|
|
9
|
-
tagName: INodeInterval;
|
|
10
|
-
}
|
|
11
|
-
export interface IHtmlInlineClosingDelimiter extends IYastTokenDelimiter, IHtmlInlineClosingTokenData {
|
|
12
|
-
type: 'full';
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A closing tag consists of the string '</', a tag name, optional whitespace,
|
|
16
|
-
* and the character '>'.
|
|
17
|
-
*
|
|
18
|
-
* @param nodePoints
|
|
19
|
-
* @param startIndex
|
|
20
|
-
* @param endIndex
|
|
21
|
-
* @see https://github.github.com/gfm/#closing-tag
|
|
22
|
-
*/
|
|
23
|
-
export declare function eatHtmlInlineClosingDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineClosingDelimiter | null;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { INodePoint } from '@yozora/character';
|
|
2
|
-
import type { IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
3
|
-
export interface IHtmlInlineCommentData {
|
|
4
|
-
htmlType: 'comment';
|
|
5
|
-
}
|
|
6
|
-
export interface IHtmlInlineCommentTokenData {
|
|
7
|
-
htmlType: 'comment';
|
|
8
|
-
}
|
|
9
|
-
export interface IHtmlInlineCommentDelimiter extends IYastTokenDelimiter, IHtmlInlineCommentTokenData {
|
|
10
|
-
type: 'full';
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* An HTML comment consists of `<!--` + text + `-->`, where text does not start
|
|
14
|
-
* with `>` or `->`, does not end with `-`, and does not contain `--`.
|
|
15
|
-
*
|
|
16
|
-
* @param nodePoints
|
|
17
|
-
* @param startIndex
|
|
18
|
-
* @param endIndex
|
|
19
|
-
* @see https://github.github.com/gfm/#html-comment
|
|
20
|
-
*/
|
|
21
|
-
export declare function eatHtmlInlineCommentDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineCommentDelimiter | null;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { INodeInterval, INodePoint } from '@yozora/character';
|
|
2
|
-
import type { IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
3
|
-
export interface IHtmlInlineDeclarationData {
|
|
4
|
-
htmlType: 'declaration';
|
|
5
|
-
}
|
|
6
|
-
export interface IHtmlInlineDeclarationTokenData {
|
|
7
|
-
htmlType: 'declaration';
|
|
8
|
-
tagName: INodeInterval;
|
|
9
|
-
}
|
|
10
|
-
export interface IHtmlInlineDeclarationDelimiter extends IYastTokenDelimiter, IHtmlInlineDeclarationTokenData {
|
|
11
|
-
type: 'full';
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* A declaration consists of the string `<!`, a name consisting of one or more
|
|
15
|
-
* uppercase ASCII letters, whitespace, a string of characters not including
|
|
16
|
-
* the character `>`, and the character `>`.
|
|
17
|
-
*
|
|
18
|
-
* @param nodePoints
|
|
19
|
-
* @param startIndex
|
|
20
|
-
* @param endIndex
|
|
21
|
-
* @see https://github.github.com/gfm/#declaration
|
|
22
|
-
*/
|
|
23
|
-
export declare function eatHtmlInlineDeclarationDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineDeclarationDelimiter | null;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { INodePoint } from '@yozora/character';
|
|
2
|
-
import type { IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @see https://github.github.com/gfm/#processing-instruction
|
|
6
|
-
*/
|
|
7
|
-
export interface IHtmlInlineInstructionData {
|
|
8
|
-
htmlType: 'instruction';
|
|
9
|
-
}
|
|
10
|
-
export interface IHtmlInlineInstructionTokenData {
|
|
11
|
-
htmlType: 'instruction';
|
|
12
|
-
}
|
|
13
|
-
export interface IHtmlInlineInstructionDelimiter extends IYastTokenDelimiter, IHtmlInlineInstructionTokenData {
|
|
14
|
-
type: 'full';
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* A processing instruction consists of the string `<?`, a string of characters
|
|
18
|
-
* not including the string `?>`, and the string `?>`.
|
|
19
|
-
*
|
|
20
|
-
* @param nodePoints
|
|
21
|
-
* @param startIndex
|
|
22
|
-
* @param endIndex
|
|
23
|
-
* @see https://github.github.com/gfm/#processing-instruction
|
|
24
|
-
*/
|
|
25
|
-
export declare function eatHtmlInlineInstructionDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineInstructionDelimiter | null;
|
package/lib/types/util/open.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { INodeInterval, INodePoint } from '@yozora/character';
|
|
2
|
-
import type { IYastTokenDelimiter } from '@yozora/core-tokenizer';
|
|
3
|
-
import type { RawHTMLAttribute } from '@yozora/tokenizer-html-block';
|
|
4
|
-
export interface IHtmlInlineOpenTagData {
|
|
5
|
-
htmlType: 'open';
|
|
6
|
-
/**
|
|
7
|
-
* HTML tag name.
|
|
8
|
-
*/
|
|
9
|
-
tagName: string;
|
|
10
|
-
/**
|
|
11
|
-
* HTML attributes.
|
|
12
|
-
*/
|
|
13
|
-
attributes: Array<{
|
|
14
|
-
name: string;
|
|
15
|
-
value?: string;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Whether if a html tag is self closed.
|
|
19
|
-
*/
|
|
20
|
-
selfClosed: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface IHtmlInlineOpenTokenData {
|
|
23
|
-
htmlType: 'open';
|
|
24
|
-
tagName: INodeInterval;
|
|
25
|
-
attributes: RawHTMLAttribute[];
|
|
26
|
-
selfClosed: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface IHtmlInlineOpenDelimiter extends IYastTokenDelimiter, IHtmlInlineOpenTokenData {
|
|
29
|
-
type: 'full';
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* An open tag consists of a '<' character, a tag name, zero or more attributes,
|
|
33
|
-
* optional whitespace, an optional '/' character, and a '>' character.
|
|
34
|
-
*
|
|
35
|
-
* @param nodePoints
|
|
36
|
-
* @param startIndex
|
|
37
|
-
* @param endIndex
|
|
38
|
-
* @see https://github.github.com/gfm/#open-tag
|
|
39
|
-
*/
|
|
40
|
-
export declare function eatHtmlInlineTokenOpenDelimiter(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number): IHtmlInlineOpenDelimiter | null;
|