@yozora/tokenizer-html-inline 2.0.2 → 2.0.4
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/package.json +7 -7
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-html-inline",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -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.4",
|
|
39
|
+
"@yozora/character": "^2.0.4",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.4",
|
|
41
|
+
"@yozora/tokenizer-html-block": "^2.0.4"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "c980b95254394dcacba0cbb4bea251350b09397c"
|
|
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;
|