@isdk/mdast-plus 0.2.3 → 0.3.0

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 (37) hide show
  1. package/README.cn.md +21 -5
  2. package/README.md +21 -5
  3. package/dist/index.d.mts +41 -3
  4. package/dist/index.d.ts +41 -3
  5. package/dist/index.js +1 -1
  6. package/dist/index.mjs +1 -1
  7. package/docs/README.md +21 -5
  8. package/docs/_media/CONTRIBUTING.md +10 -0
  9. package/docs/_media/README.cn.md +21 -5
  10. package/docs/classes/MdastBasePipeline.md +20 -20
  11. package/docs/classes/MdastPipeline.md +27 -27
  12. package/docs/enumerations/PipelineStage.md +6 -6
  13. package/docs/functions/astCompiler.md +1 -1
  14. package/docs/functions/checkHtmlUrlExists.md +25 -0
  15. package/docs/functions/checkUrlExists.md +25 -0
  16. package/docs/functions/jsonParser.md +1 -1
  17. package/docs/functions/mdast.md +1 -1
  18. package/docs/globals.md +3 -0
  19. package/docs/interfaces/MdastDataOrigin.md +4 -4
  20. package/docs/interfaces/MdastFormat.md +7 -7
  21. package/docs/interfaces/MdastMark.md +3 -3
  22. package/docs/interfaces/MdastPlugin.md +9 -9
  23. package/docs/interfaces/MdastSub.md +3 -3
  24. package/docs/interfaces/MdastSup.md +3 -3
  25. package/docs/interfaces/PipelineRunOptions.md +4 -4
  26. package/docs/interfaces/ReadabilityOptions.md +67 -6
  27. package/docs/interfaces/SmartExcerptOptions.md +43 -0
  28. package/docs/type-aliases/PipelineStageName.md +1 -1
  29. package/docs/variables/DefaultPipelineStage.md +1 -1
  30. package/docs/variables/astFormat.md +1 -1
  31. package/docs/variables/htmlFormat.md +1 -1
  32. package/docs/variables/htmlReadability.md +1 -1
  33. package/docs/variables/htmlReadabilityPlugin.md +1 -1
  34. package/docs/variables/htmlReadabilityPlugins.md +2 -2
  35. package/docs/variables/markdownFormat.md +1 -1
  36. package/docs/variables/restoreReadabilityMetaPlugin.md +8 -2
  37. package/package.json +1 -1
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: MdastFormat
8
8
 
9
- Defined in: [packages/mdast-plus/src/types.ts:66](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L66)
9
+ Defined in: [packages/mdast-plus/src/types.ts:66](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L66)
10
10
 
11
11
  Defines a document format, encompassing its input (parsing) and output (serialization) strategies.
12
12
 
@@ -16,7 +16,7 @@ Defines a document format, encompassing its input (parsing) and output (serializ
16
16
 
17
17
  > `optional` **extensions**: `string`[]
18
18
 
19
- Defined in: [packages/mdast-plus/src/types.ts:72](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L72)
19
+ Defined in: [packages/mdast-plus/src/types.ts:72](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L72)
20
20
 
21
21
  File extensions associated with this format.
22
22
 
@@ -26,7 +26,7 @@ File extensions associated with this format.
26
26
 
27
27
  > **id**: `string`
28
28
 
29
- Defined in: [packages/mdast-plus/src/types.ts:68](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L68)
29
+ Defined in: [packages/mdast-plus/src/types.ts:68](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L68)
30
30
 
31
31
  Unique identifier for the format (e.g., 'markdown', 'html').
32
32
 
@@ -36,7 +36,7 @@ Unique identifier for the format (e.g., 'markdown', 'html').
36
36
 
37
37
  > `optional` **input**: [`MdastPlugin`](MdastPlugin.md)[]
38
38
 
39
- Defined in: [packages/mdast-plus/src/types.ts:77](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L77)
39
+ Defined in: [packages/mdast-plus/src/types.ts:77](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L77)
40
40
 
41
41
  Plugins used for reading this format into a standard AST (Parser + Normalizer).
42
42
 
@@ -46,7 +46,7 @@ Plugins used for reading this format into a standard AST (Parser + Normalizer).
46
46
 
47
47
  > `optional` **mediaTypes**: `string`[]
48
48
 
49
- Defined in: [packages/mdast-plus/src/types.ts:74](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L74)
49
+ Defined in: [packages/mdast-plus/src/types.ts:74](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L74)
50
50
 
51
51
  MIME types associated with this format.
52
52
 
@@ -56,7 +56,7 @@ MIME types associated with this format.
56
56
 
57
57
  > `optional` **output**: [`MdastPlugin`](MdastPlugin.md)[]
58
58
 
59
- Defined in: [packages/mdast-plus/src/types.ts:80](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L80)
59
+ Defined in: [packages/mdast-plus/src/types.ts:80](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L80)
60
60
 
61
61
  Plugins used for serializing the AST into this format (Finalizer + Stringifier).
62
62
 
@@ -66,6 +66,6 @@ Plugins used for serializing the AST into this format (Finalizer + Stringifier).
66
66
 
67
67
  > `optional` **title**: `string`
68
68
 
69
- Defined in: [packages/mdast-plus/src/types.ts:70](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L70)
69
+ Defined in: [packages/mdast-plus/src/types.ts:70](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L70)
70
70
 
71
71
  Human-readable title.
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: MdastMark
8
8
 
9
- Defined in: [packages/mdast-plus/src/types.ts:118](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L118)
9
+ Defined in: [packages/mdast-plus/src/types.ts:118](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L118)
10
10
 
11
11
  Represents a highlighted text (mark) node in mdast.
12
12
 
@@ -20,7 +20,7 @@ Represents a highlighted text (mark) node in mdast.
20
20
 
21
21
  > **children**: `PhrasingContent`[]
22
22
 
23
- Defined in: [packages/mdast-plus/src/types.ts:120](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L120)
23
+ Defined in: [packages/mdast-plus/src/types.ts:120](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L120)
24
24
 
25
25
  List of children.
26
26
 
@@ -65,7 +65,7 @@ have a position.
65
65
 
66
66
  > **type**: `"mark"`
67
67
 
68
- Defined in: [packages/mdast-plus/src/types.ts:119](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L119)
68
+ Defined in: [packages/mdast-plus/src/types.ts:119](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L119)
69
69
 
70
70
  Node type.
71
71
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: MdastPlugin
8
8
 
9
- Defined in: [packages/mdast-plus/src/types.ts:33](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L33)
9
+ Defined in: [packages/mdast-plus/src/types.ts:33](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L33)
10
10
 
11
11
  Configuration for a plugin within the mdast-plus pipeline.
12
12
  It wraps a standard unified plugin with execution metadata.
@@ -17,7 +17,7 @@ It wraps a standard unified plugin with execution metadata.
17
17
 
18
18
  > `optional` **after**: `string`
19
19
 
20
- Defined in: [packages/mdast-plus/src/types.ts:60](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L60)
20
+ Defined in: [packages/mdast-plus/src/types.ts:60](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L60)
21
21
 
22
22
  Run this plugin after the named plugin (within the same stage).
23
23
 
@@ -27,7 +27,7 @@ Run this plugin after the named plugin (within the same stage).
27
27
 
28
28
  > `optional` **before**: `string`
29
29
 
30
- Defined in: [packages/mdast-plus/src/types.ts:58](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L58)
30
+ Defined in: [packages/mdast-plus/src/types.ts:58](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L58)
31
31
 
32
32
  Run this plugin before the named plugin (within the same stage).
33
33
 
@@ -37,7 +37,7 @@ Run this plugin before the named plugin (within the same stage).
37
37
 
38
38
  > `optional` **main**: `boolean`
39
39
 
40
- Defined in: [packages/mdast-plus/src/types.ts:56](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L56)
40
+ Defined in: [packages/mdast-plus/src/types.ts:56](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L56)
41
41
 
42
42
  If true, this plugin is considered the "main" plugin for its stage.
43
43
  When multiple plugins exist in the same stage, a 'main' plugin will
@@ -49,7 +49,7 @@ replace the default (first) plugin of that stage.
49
49
 
50
50
  > `optional` **name**: `string`
51
51
 
52
- Defined in: [packages/mdast-plus/src/types.ts:39](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L39)
52
+ Defined in: [packages/mdast-plus/src/types.ts:39](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L39)
53
53
 
54
54
  Optional name for the plugin.
55
55
  Used for identification in overrides and logging.
@@ -61,7 +61,7 @@ If not provided, defaults to the plugin function's name.
61
61
 
62
62
  > `optional` **options**: `any`[]
63
63
 
64
- Defined in: [packages/mdast-plus/src/types.ts:46](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L46)
64
+ Defined in: [packages/mdast-plus/src/types.ts:46](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L46)
65
65
 
66
66
  Arguments passed to the plugin.
67
67
  MUST be an array of arguments (e.g., [optionsObject]).
@@ -72,7 +72,7 @@ MUST be an array of arguments (e.g., [optionsObject]).
72
72
 
73
73
  > `optional` **order**: `number`
74
74
 
75
- Defined in: [packages/mdast-plus/src/types.ts:50](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L50)
75
+ Defined in: [packages/mdast-plus/src/types.ts:50](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L50)
76
76
 
77
77
  Execution priority within the same stage. Lower values run earlier.
78
78
 
@@ -82,7 +82,7 @@ Execution priority within the same stage. Lower values run earlier.
82
82
 
83
83
  > **plugin**: `Plugin`\<`any`[], `any`, `any`\>
84
84
 
85
- Defined in: [packages/mdast-plus/src/types.ts:41](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L41)
85
+ Defined in: [packages/mdast-plus/src/types.ts:41](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L41)
86
86
 
87
87
  The standard unified plugin (attacher) function.
88
88
 
@@ -92,6 +92,6 @@ The standard unified plugin (attacher) function.
92
92
 
93
93
  > `optional` **stage**: [`PipelineStage`](../enumerations/PipelineStage.md) \| `"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
94
94
 
95
- Defined in: [packages/mdast-plus/src/types.ts:48](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L48)
95
+ Defined in: [packages/mdast-plus/src/types.ts:48](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L48)
96
96
 
97
97
  The stage in which this plugin should run.
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: MdastSub
8
8
 
9
- Defined in: [packages/mdast-plus/src/types.ts:124](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L124)
9
+ Defined in: [packages/mdast-plus/src/types.ts:124](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L124)
10
10
 
11
11
  Represents a subscript text node in mdast.
12
12
 
@@ -20,7 +20,7 @@ Represents a subscript text node in mdast.
20
20
 
21
21
  > **children**: `PhrasingContent`[]
22
22
 
23
- Defined in: [packages/mdast-plus/src/types.ts:126](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L126)
23
+ Defined in: [packages/mdast-plus/src/types.ts:126](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L126)
24
24
 
25
25
  List of children.
26
26
 
@@ -65,7 +65,7 @@ have a position.
65
65
 
66
66
  > **type**: `"sub"`
67
67
 
68
- Defined in: [packages/mdast-plus/src/types.ts:125](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L125)
68
+ Defined in: [packages/mdast-plus/src/types.ts:125](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L125)
69
69
 
70
70
  Node type.
71
71
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: MdastSup
8
8
 
9
- Defined in: [packages/mdast-plus/src/types.ts:130](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L130)
9
+ Defined in: [packages/mdast-plus/src/types.ts:130](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L130)
10
10
 
11
11
  Represents a superscript text node in mdast.
12
12
 
@@ -20,7 +20,7 @@ Represents a superscript text node in mdast.
20
20
 
21
21
  > **children**: `PhrasingContent`[]
22
22
 
23
- Defined in: [packages/mdast-plus/src/types.ts:132](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L132)
23
+ Defined in: [packages/mdast-plus/src/types.ts:132](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L132)
24
24
 
25
25
  List of children.
26
26
 
@@ -65,7 +65,7 @@ have a position.
65
65
 
66
66
  > **type**: `"sup"`
67
67
 
68
- Defined in: [packages/mdast-plus/src/types.ts:131](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L131)
68
+ Defined in: [packages/mdast-plus/src/types.ts:131](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/types.ts#L131)
69
69
 
70
70
  Node type.
71
71
 
@@ -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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L86)
9
+ Defined in: [packages/mdast-plus/src/types.ts:86](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L101)
19
+ Defined in: [packages/mdast-plus/src/types.ts:101](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L91)
29
+ Defined in: [packages/mdast-plus/src/types.ts:91](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L97)
40
+ Defined in: [packages/mdast-plus/src/types.ts:97](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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,43 @@
6
6
 
7
7
  # Interface: ReadabilityOptions
8
8
 
9
- Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:7](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L7)
9
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:25](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L25)
10
10
 
11
11
  ## Properties
12
12
 
13
+ ### fields?
14
+
15
+ > `optional` **fields**: `string`[] \| `Record`\<`string`, `string`\>
16
+
17
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:53](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L53)
18
+
19
+ Control the fields and names in metadata.
20
+ - If an array of strings, it acts as an allowlist (only these fields are kept).
21
+ - If an object, it maps original field names to new names. Only the keys present in the map are kept (Projection).
22
+
23
+ ***
24
+
25
+ ### frontmatter?
26
+
27
+ > `optional` **frontmatter**: `boolean` \| `"yaml"` \| `"toml"`
28
+
29
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:36](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L36)
30
+
31
+ Whether to inject metadata as frontmatter.
32
+
33
+ #### Default
34
+
35
+ ```ts
36
+ false
37
+ ```
38
+
39
+ ***
40
+
13
41
  ### hast?
14
42
 
15
43
  > `optional` **hast**: `Record`\<`string`, `any`\>
16
44
 
17
- Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:12](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L12)
45
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:30](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L30)
18
46
 
19
47
  ***
20
48
 
@@ -22,7 +50,7 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:12](https://git
22
50
 
23
51
  > `optional` **jsdom**: `Record`\<`string`, `any`\>
24
52
 
25
- Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:11](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L11)
53
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:29](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L29)
26
54
 
27
55
  ***
28
56
 
@@ -30,7 +58,7 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:11](https://git
30
58
 
31
59
  > `optional` **readability**: `false` \| `Record`\<`string`, `any`\>
32
60
 
33
- Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:10](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L10)
61
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:28](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L28)
34
62
 
35
63
  ***
36
64
 
@@ -38,7 +66,40 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:10](https://git
38
66
 
39
67
  > `optional` **rehype-parse**: `Record`\<`string`, `any`\>
40
68
 
41
- Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:13](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L13)
69
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:31](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L31)
70
+
71
+ ***
72
+
73
+ ### smartExcerpt?
74
+
75
+ > `optional` **smartExcerpt**: `boolean` \| [`SmartExcerptOptions`](SmartExcerptOptions.md)
76
+
77
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:47](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L47)
78
+
79
+ Whether to remove the excerpt if it is a duplicate or near-duplicate of the main content.
80
+ Useful when the content is short or the excerpt is just a subset of the content.
81
+
82
+ #### Default
83
+
84
+ ```ts
85
+ true
86
+ ```
87
+
88
+ ***
89
+
90
+ ### sourceLink?
91
+
92
+ > `optional` **sourceLink**: `boolean`
93
+
94
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:41](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L41)
95
+
96
+ Whether to append source link at the bottom.
97
+
98
+ #### Default
99
+
100
+ ```ts
101
+ false
102
+ ```
42
103
 
43
104
  ***
44
105
 
@@ -46,4 +107,4 @@ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:13](https://git
46
107
 
47
108
  > `optional` **url**: `string`
48
109
 
49
- Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:9](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L9)
110
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:27](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L27)
@@ -0,0 +1,43 @@
1
+ [**@isdk/mdast-plus**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/mdast-plus](../globals.md) / SmartExcerptOptions
6
+
7
+ # Interface: SmartExcerptOptions
8
+
9
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:10](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L10)
10
+
11
+ ## Properties
12
+
13
+ ### minContentLength?
14
+
15
+ > `optional` **minContentLength**: `number`
16
+
17
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:22](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L22)
18
+
19
+ The minimum length of the main content required to keep the excerpt.
20
+ If content length is less than this value, the excerpt is considered redundant (if it is contained in the content).
21
+
22
+ #### Default
23
+
24
+ ```ts
25
+ 300
26
+ ```
27
+
28
+ ***
29
+
30
+ ### threshold?
31
+
32
+ > `optional` **threshold**: `number`
33
+
34
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:16](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L16)
35
+
36
+ The threshold ratio of excerpt length to content length.
37
+ If (excerptLength / contentLength) > threshold, the excerpt is considered redundant.
38
+
39
+ #### Default
40
+
41
+ ```ts
42
+ 0.6
43
+ ```
@@ -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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L27)
11
+ Defined in: [packages/mdast-plus/src/types.ts:27](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/types.ts#L24)
11
+ Defined in: [packages/mdast-plus/src/types.ts:24](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/formats/ast.ts#L35)
11
+ Defined in: [packages/mdast-plus/src/formats/ast.ts:35](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/formats/html.ts#L71)
11
+ Defined in: [packages/mdast-plus/src/formats/html.ts:71](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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:19](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L19)
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:59](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L59)
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:119](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L119)
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:218](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L218)
12
12
 
13
13
  Pre-configured MdastPlugin for html-readability.
14
14
 
@@ -6,8 +6,8 @@
6
6
 
7
7
  # Variable: htmlReadabilityPlugins
8
8
 
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`: () => (`tree`, `file`) => `void`; `stage`: [`PipelineStage`](../enumerations/PipelineStage.md); \})[]
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:146](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L146)
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:277](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L277)
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/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/formats/markdown.ts#L103)
11
+ Defined in: [packages/mdast-plus/src/formats/markdown.ts:103](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/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:131](https://github.com/isdk/mdast-plus.js/blob/b08b74cf958d7f9ed7bee309acc7e659bc74da3c/src/plugins/html-readability.ts#L131)
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:230](https://github.com/isdk/mdast-plus.js/blob/fc889343b0a625d8edbf2036c3e25b676d1bf163/src/plugins/html-readability.ts#L230)
12
12
 
13
13
  Plugin to restore readability metadata after HAST to MDAST conversion.
14
14
 
@@ -24,7 +24,13 @@ Plugin to restore readability metadata after HAST to MDAST conversion.
24
24
 
25
25
  ### plugin()
26
26
 
27
- > **plugin**: () => (`tree`, `file`) => `void`
27
+ > **plugin**: (`options?`) => (`tree`, `file`) => `void`
28
+
29
+ #### Parameters
30
+
31
+ ##### options?
32
+
33
+ [`ReadabilityOptions`](../interfaces/ReadabilityOptions.md)
28
34
 
29
35
  #### Returns
30
36
 
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.2.3",
4
+ "version": "0.3.0",
5
5
  "license": "MIT",
6
6
  "author": "Riceball LEE <snowyu.lee@gmail.com>",
7
7
  "homepage": "https://github.com/isdk/mdast-plus.js",