@yozora/tokenizer-image 2.0.2 → 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/package.json +7 -7
- package/lib/types/match.d.ts +0 -30
- package/lib/types/parse.d.ts +0 -3
- package/lib/types/tokenizer.d.ts +0 -13
- package/lib/types/types.d.ts +0 -35
- package/lib/types/util.d.ts +0 -8
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-image",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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-link": "^2.0.
|
|
38
|
+
"@yozora/ast": "^2.0.3",
|
|
39
|
+
"@yozora/character": "^2.0.3",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.3",
|
|
41
|
+
"@yozora/tokenizer-link": "^2.0.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "8cc8f95cfebc8d752bc3272cdd24965f540c130b"
|
|
44
44
|
}
|
package/lib/types/match.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { IMatchInlineHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
-
import type { IDelimiter, IThis, IToken, T } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Syntax for images is like the syntax for links, with one difference.
|
|
5
|
-
* Instead of link text, we have an image description.
|
|
6
|
-
* The rules for this are the same as for link text, except that
|
|
7
|
-
*
|
|
8
|
-
* a) an image description starts with ''
|
|
23
|
-
* - '](url "title")'
|
|
24
|
-
* - '](<url>)'
|
|
25
|
-
* - '](<url> "title")'
|
|
26
|
-
*
|
|
27
|
-
* @see https://github.com/syntax-tree/mdast#image
|
|
28
|
-
* @see https://github.github.com/gfm/#images
|
|
29
|
-
*/
|
|
30
|
-
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 InlineImage.
|
|
6
|
-
* @see https://github.com/syntax-tree/mdast#image
|
|
7
|
-
* @see https://github.github.com/gfm/#images
|
|
8
|
-
*/
|
|
9
|
-
export declare class ImageTokenizer 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,35 +0,0 @@
|
|
|
1
|
-
import type { Image, ImageType } 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 = ImageType;
|
|
5
|
-
export declare type INode = Image;
|
|
6
|
-
export declare const uniqueName = "@yozora/tokenizer-image";
|
|
7
|
-
/**
|
|
8
|
-
* An image token.
|
|
9
|
-
*/
|
|
10
|
-
export interface IToken extends IPartialYastInlineToken<T> {
|
|
11
|
-
/**
|
|
12
|
-
* Link destination interval.
|
|
13
|
-
*/
|
|
14
|
-
destinationContent?: INodeInterval;
|
|
15
|
-
/**
|
|
16
|
-
* Link title interval.
|
|
17
|
-
*/
|
|
18
|
-
titleContent?: INodeInterval;
|
|
19
|
-
}
|
|
20
|
-
export interface IDelimiter extends IYastTokenDelimiter {
|
|
21
|
-
/**
|
|
22
|
-
* IDelimiter type.
|
|
23
|
-
*/
|
|
24
|
-
type: 'opener' | 'closer';
|
|
25
|
-
/**
|
|
26
|
-
* link destination
|
|
27
|
-
*/
|
|
28
|
-
destinationContent?: INodeInterval;
|
|
29
|
-
/**
|
|
30
|
-
* link title
|
|
31
|
-
*/
|
|
32
|
-
titleContent?: INodeInterval;
|
|
33
|
-
}
|
|
34
|
-
export declare type IThis = ITokenizer;
|
|
35
|
-
export declare type ITokenizerProps = Partial<IBaseInlineTokenizerProps>;
|
package/lib/types/util.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@yozora/ast';
|
|
2
|
-
/**
|
|
3
|
-
* calc alt
|
|
4
|
-
* An image description has inline elements as its contents. When an image
|
|
5
|
-
* is rendered to HTML, this is standardly used as the image’s alt attribute
|
|
6
|
-
* @see https://github.github.com/gfm/#example-582
|
|
7
|
-
*/
|
|
8
|
-
export declare function calcImageAlt(nodes: ReadonlyArray<Node>): string;
|