@isdk/mdast-plus 0.3.1 → 0.3.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/README.cn.md +16 -0
- package/README.md +16 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +16 -0
- package/docs/_media/README.cn.md +16 -0
- package/docs/classes/MdastBasePipeline.md +20 -20
- package/docs/classes/MdastPipeline.md +41 -29
- package/docs/enumerations/PipelineStage.md +6 -6
- package/docs/functions/astCompiler.md +1 -1
- package/docs/functions/checkHtmlUrlExists.md +1 -1
- package/docs/functions/checkUrlExists.md +1 -1
- package/docs/functions/jsonParser.md +1 -1
- package/docs/functions/mdast.md +1 -1
- package/docs/interfaces/MdastDataOrigin.md +4 -4
- package/docs/interfaces/MdastFormat.md +7 -7
- package/docs/interfaces/MdastMark.md +3 -3
- package/docs/interfaces/MdastPlugin.md +9 -9
- package/docs/interfaces/MdastSub.md +3 -3
- package/docs/interfaces/MdastSup.md +3 -3
- package/docs/interfaces/PipelineRunOptions.md +4 -4
- package/docs/interfaces/ReadabilityOptions.md +21 -10
- package/docs/interfaces/SmartExcerptOptions.md +3 -3
- package/docs/type-aliases/PipelineStageName.md +1 -1
- package/docs/variables/DefaultPipelineStage.md +1 -1
- package/docs/variables/astFormat.md +1 -1
- package/docs/variables/htmlFormat.md +1 -1
- package/docs/variables/htmlReadability.md +1 -1
- package/docs/variables/htmlReadabilityPlugin.md +1 -1
- package/docs/variables/htmlReadabilityPlugins.md +1 -1
- package/docs/variables/markdownFormat.md +1 -1
- package/docs/variables/restoreReadabilityMetaPlugin.md +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: PipelineRunOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/types.ts:86](https://github.com/isdk/mdast-plus.js/blob/
|
|
9
|
+
Defined in: [packages/mdast-plus/src/types.ts:86](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/types.ts#L86)
|
|
10
10
|
|
|
11
11
|
Options for controlling the pipeline execution.
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Options for controlling the pipeline execution.
|
|
|
16
16
|
|
|
17
17
|
> `optional` **overrides**: `Record`\<`string`, `any`\>
|
|
18
18
|
|
|
19
|
-
Defined in: [packages/mdast-plus/src/types.ts:101](https://github.com/isdk/mdast-plus.js/blob/
|
|
19
|
+
Defined in: [packages/mdast-plus/src/types.ts:101](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/types.ts#L101)
|
|
20
20
|
|
|
21
21
|
Map of plugin names to their option overrides.
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ Map of plugin names to their option overrides.
|
|
|
26
26
|
|
|
27
27
|
> `optional` **stage**: [`PipelineStage`](../enumerations/PipelineStage.md) \| `"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
|
|
28
28
|
|
|
29
|
-
Defined in: [packages/mdast-plus/src/types.ts:91](https://github.com/isdk/mdast-plus.js/blob/
|
|
29
|
+
Defined in: [packages/mdast-plus/src/types.ts:91](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/types.ts#L91)
|
|
30
30
|
|
|
31
31
|
Run the pipeline only up to the specified stage.
|
|
32
32
|
Useful for debugging or inspecting intermediate ASTs.
|
|
@@ -37,7 +37,7 @@ Useful for debugging or inspecting intermediate ASTs.
|
|
|
37
37
|
|
|
38
38
|
> `optional` **stopAtIndex**: `number`
|
|
39
39
|
|
|
40
|
-
Defined in: [packages/mdast-plus/src/types.ts:97](https://github.com/isdk/mdast-plus.js/blob/
|
|
40
|
+
Defined in: [packages/mdast-plus/src/types.ts:97](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/types.ts#L97)
|
|
41
41
|
|
|
42
42
|
If `stage` is specified, stop execution at this index (0-based)
|
|
43
43
|
within the list of plugins at that stage.
|
|
@@ -6,15 +6,26 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: ReadabilityOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:26](https://github.com/isdk/mdast-plus.js/blob/
|
|
9
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:26](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L26)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
|
+
### extraMetadata?
|
|
14
|
+
|
|
15
|
+
> `optional` **extraMetadata**: `Record`\<`string`, `any`\>
|
|
16
|
+
|
|
17
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:59](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L59)
|
|
18
|
+
|
|
19
|
+
Extra key-value pairs to inject into the frontmatter.
|
|
20
|
+
These will be merged with the readability metadata.
|
|
21
|
+
|
|
22
|
+
***
|
|
23
|
+
|
|
13
24
|
### fields?
|
|
14
25
|
|
|
15
26
|
> `optional` **fields**: `string`[] \| `Record`\<`string`, `string`\>
|
|
16
27
|
|
|
17
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:54](https://github.com/isdk/mdast-plus.js/blob/
|
|
28
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:54](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L54)
|
|
18
29
|
|
|
19
30
|
Control the fields and names in metadata.
|
|
20
31
|
- If an array of strings, it acts as an allowlist (only these fields are kept).
|
|
@@ -26,7 +37,7 @@ Control the fields and names in metadata.
|
|
|
26
37
|
|
|
27
38
|
> `optional` **frontmatter**: `boolean` \| `"yaml"` \| `"toml"`
|
|
28
39
|
|
|
29
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:37](https://github.com/isdk/mdast-plus.js/blob/
|
|
40
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:37](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L37)
|
|
30
41
|
|
|
31
42
|
Whether to inject metadata as frontmatter.
|
|
32
43
|
|
|
@@ -42,7 +53,7 @@ false
|
|
|
42
53
|
|
|
43
54
|
> `optional` **hast**: `Record`\<`string`, `any`\>
|
|
44
55
|
|
|
45
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:31](https://github.com/isdk/mdast-plus.js/blob/
|
|
56
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:31](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L31)
|
|
46
57
|
|
|
47
58
|
***
|
|
48
59
|
|
|
@@ -50,7 +61,7 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:31](https://git
|
|
|
50
61
|
|
|
51
62
|
> `optional` **jsdom**: `Record`\<`string`, `any`\>
|
|
52
63
|
|
|
53
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:30](https://github.com/isdk/mdast-plus.js/blob/
|
|
64
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:30](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L30)
|
|
54
65
|
|
|
55
66
|
***
|
|
56
67
|
|
|
@@ -58,7 +69,7 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:30](https://git
|
|
|
58
69
|
|
|
59
70
|
> `optional` **readability**: `false` \| `Record`\<`string`, `any`\>
|
|
60
71
|
|
|
61
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:29](https://github.com/isdk/mdast-plus.js/blob/
|
|
72
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:29](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L29)
|
|
62
73
|
|
|
63
74
|
***
|
|
64
75
|
|
|
@@ -66,7 +77,7 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:29](https://git
|
|
|
66
77
|
|
|
67
78
|
> `optional` **rehype-parse**: `Record`\<`string`, `any`\>
|
|
68
79
|
|
|
69
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:32](https://github.com/isdk/mdast-plus.js/blob/
|
|
80
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:32](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L32)
|
|
70
81
|
|
|
71
82
|
***
|
|
72
83
|
|
|
@@ -74,7 +85,7 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:32](https://git
|
|
|
74
85
|
|
|
75
86
|
> `optional` **smartExcerpt**: `boolean` \| [`SmartExcerptOptions`](SmartExcerptOptions.md)
|
|
76
87
|
|
|
77
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:48](https://github.com/isdk/mdast-plus.js/blob/
|
|
88
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:48](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L48)
|
|
78
89
|
|
|
79
90
|
Whether to remove the excerpt if it is a duplicate or near-duplicate of the main content.
|
|
80
91
|
Useful when the content is short or the excerpt is just a subset of the content.
|
|
@@ -91,7 +102,7 @@ true
|
|
|
91
102
|
|
|
92
103
|
> `optional` **sourceLink**: `boolean`
|
|
93
104
|
|
|
94
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:42](https://github.com/isdk/mdast-plus.js/blob/
|
|
105
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:42](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L42)
|
|
95
106
|
|
|
96
107
|
Whether to append source link at the bottom.
|
|
97
108
|
|
|
@@ -107,4 +118,4 @@ false
|
|
|
107
118
|
|
|
108
119
|
> `optional` **url**: `string`
|
|
109
120
|
|
|
110
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:28](https://github.com/isdk/mdast-plus.js/blob/
|
|
121
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:28](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L28)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: SmartExcerptOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:11](https://github.com/isdk/mdast-plus.js/blob/
|
|
9
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:11](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L11)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:11](https://git
|
|
|
14
14
|
|
|
15
15
|
> `optional` **minContentLength**: `number`
|
|
16
16
|
|
|
17
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:23](https://github.com/isdk/mdast-plus.js/blob/
|
|
17
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:23](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L23)
|
|
18
18
|
|
|
19
19
|
The minimum length of the main content required to keep the excerpt.
|
|
20
20
|
If content length is less than this value, the excerpt is considered redundant (if it is contained in the content).
|
|
@@ -31,7 +31,7 @@ If content length is less than this value, the excerpt is considered redundant (
|
|
|
31
31
|
|
|
32
32
|
> `optional` **threshold**: `number`
|
|
33
33
|
|
|
34
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:17](https://github.com/isdk/mdast-plus.js/blob/
|
|
34
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:17](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L17)
|
|
35
35
|
|
|
36
36
|
The threshold ratio of excerpt length to content length.
|
|
37
37
|
If (excerptLength / contentLength) > threshold, the excerpt is considered redundant.
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
> **PipelineStageName** = keyof *typeof* [`PipelineStage`](../enumerations/PipelineStage.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/types.ts:27](https://github.com/isdk/mdast-plus.js/blob/
|
|
11
|
+
Defined in: [packages/mdast-plus/src/types.ts:27](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/types.ts#L27)
|
|
12
12
|
|
|
13
13
|
String names corresponding to the PipelineStage levels.
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **DefaultPipelineStage**: [`compile`](../enumerations/PipelineStage.md#compile) = `PipelineStage.compile`
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/types.ts:24](https://github.com/isdk/mdast-plus.js/blob/
|
|
11
|
+
Defined in: [packages/mdast-plus/src/types.ts:24](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/types.ts#L24)
|
|
12
12
|
|
|
13
13
|
The default stage assigned to a plugin if none is specified.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **astFormat**: [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/formats/ast.ts:35](https://github.com/isdk/mdast-plus.js/blob/
|
|
11
|
+
Defined in: [packages/mdast-plus/src/formats/ast.ts:35](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/formats/ast.ts#L35)
|
|
12
12
|
|
|
13
13
|
AST (MDAST) format definition.
|
|
14
14
|
Supports reading from JSON strings and provides full normalization
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **htmlFormat**: [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/formats/html.ts:71](https://github.com/isdk/mdast-plus.js/blob/
|
|
11
|
+
Defined in: [packages/mdast-plus/src/formats/html.ts:71](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/formats/html.ts#L71)
|
|
12
12
|
|
|
13
13
|
HTML format definition.
|
|
14
14
|
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **htmlReadability**: `Plugin`\<\[[`ReadabilityOptions`](../interfaces/ReadabilityOptions.md)?\], `string`, `Root`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:
|
|
11
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:65](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L65)
|
|
12
12
|
|
|
13
13
|
A unified/rehype plugin that uses Mozilla's Readability to parse the input HTML.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **htmlReadabilityPlugin**: `object`
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:
|
|
11
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:228](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L228)
|
|
12
12
|
|
|
13
13
|
Pre-configured MdastPlugin for html-readability.
|
|
14
14
|
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **htmlReadabilityPlugins**: (\{ `main`: `boolean`; `name`: `string`; `plugin`: `Plugin`\<\[[`ReadabilityOptions`](../interfaces/ReadabilityOptions.md)?\], `string`, `Root`\>; `stage`: [`PipelineStage`](../enumerations/PipelineStage.md); \} \| \{ `after`: `string`; `name`: `string`; `plugin`: (`options?`) => (`tree`, `file`) => `void`; `stage`: [`PipelineStage`](../enumerations/PipelineStage.md); \})[]
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:
|
|
11
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:289](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L289)
|
|
12
12
|
|
|
13
13
|
Combined plugins for HTML readability.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **markdownFormat**: [`MdastFormat`](../interfaces/MdastFormat.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/formats/markdown.ts:103](https://github.com/isdk/mdast-plus.js/blob/
|
|
11
|
+
Defined in: [packages/mdast-plus/src/formats/markdown.ts:103](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/formats/markdown.ts#L103)
|
|
12
12
|
|
|
13
13
|
Markdown format definition.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> `const` **restoreReadabilityMetaPlugin**: `object`
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:
|
|
11
|
+
Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:240](https://github.com/isdk/mdast-plus.js/blob/ffc9e04d9148d701d741216735d74489ec419562/src/plugins/html-readability.ts#L240)
|
|
12
12
|
|
|
13
13
|
Plugin to restore readability metadata after HAST to MDAST conversion.
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isdk/mdast-plus",
|
|
3
3
|
"description": "A semantic-first Markdown processing toolkit based on unified, remark, and rehype with a Fluent API and staged plugin system.",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Riceball LEE <snowyu.lee@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/isdk/mdast-plus.js",
|