@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.
Files changed (35) hide show
  1. package/README.cn.md +16 -0
  2. package/README.md +16 -0
  3. package/dist/index.d.mts +10 -1
  4. package/dist/index.d.ts +10 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.mjs +1 -1
  7. package/docs/README.md +16 -0
  8. package/docs/_media/README.cn.md +16 -0
  9. package/docs/classes/MdastBasePipeline.md +20 -20
  10. package/docs/classes/MdastPipeline.md +41 -29
  11. package/docs/enumerations/PipelineStage.md +6 -6
  12. package/docs/functions/astCompiler.md +1 -1
  13. package/docs/functions/checkHtmlUrlExists.md +1 -1
  14. package/docs/functions/checkUrlExists.md +1 -1
  15. package/docs/functions/jsonParser.md +1 -1
  16. package/docs/functions/mdast.md +1 -1
  17. package/docs/interfaces/MdastDataOrigin.md +4 -4
  18. package/docs/interfaces/MdastFormat.md +7 -7
  19. package/docs/interfaces/MdastMark.md +3 -3
  20. package/docs/interfaces/MdastPlugin.md +9 -9
  21. package/docs/interfaces/MdastSub.md +3 -3
  22. package/docs/interfaces/MdastSup.md +3 -3
  23. package/docs/interfaces/PipelineRunOptions.md +4 -4
  24. package/docs/interfaces/ReadabilityOptions.md +21 -10
  25. package/docs/interfaces/SmartExcerptOptions.md +3 -3
  26. package/docs/type-aliases/PipelineStageName.md +1 -1
  27. package/docs/variables/DefaultPipelineStage.md +1 -1
  28. package/docs/variables/astFormat.md +1 -1
  29. package/docs/variables/htmlFormat.md +1 -1
  30. package/docs/variables/htmlReadability.md +1 -1
  31. package/docs/variables/htmlReadabilityPlugin.md +1 -1
  32. package/docs/variables/htmlReadabilityPlugins.md +1 -1
  33. package/docs/variables/markdownFormat.md +1 -1
  34. package/docs/variables/restoreReadabilityMetaPlugin.md +1 -1
  35. 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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/types.ts#L86)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/types.ts#L101)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/types.ts#L91)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/types.ts#L97)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L26)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L54)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L37)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L31)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L30)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L29)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L32)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L48)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L42)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L28)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L11)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L23)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L17)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/types.ts#L27)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/types.ts#L24)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/formats/ast.ts#L35)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/formats/html.ts#L71)
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:60](https://github.com/isdk/mdast-plus.js/blob/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L60)
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:219](https://github.com/isdk/mdast-plus.js/blob/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L219)
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:278](https://github.com/isdk/mdast-plus.js/blob/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L278)
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/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/formats/markdown.ts#L103)
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:231](https://github.com/isdk/mdast-plus.js/blob/63ad0024c4c259bf87070606fda5c1b86ee2db1d/src/plugins/html-readability.ts#L231)
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.1",
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",