@isdk/mdast-plus 0.1.3 → 0.2.1

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.
@@ -6,18 +6,50 @@
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/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L33)
9
+ Defined in: [packages/mdast-plus/src/types.ts:33](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/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.
13
13
 
14
14
  ## Properties
15
15
 
16
+ ### after?
17
+
18
+ > `optional` **after**: `string`
19
+
20
+ Defined in: [packages/mdast-plus/src/types.ts:60](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L60)
21
+
22
+ Run this plugin after the named plugin (within the same stage).
23
+
24
+ ***
25
+
26
+ ### before?
27
+
28
+ > `optional` **before**: `string`
29
+
30
+ Defined in: [packages/mdast-plus/src/types.ts:58](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L58)
31
+
32
+ Run this plugin before the named plugin (within the same stage).
33
+
34
+ ***
35
+
36
+ ### main?
37
+
38
+ > `optional` **main**: `boolean`
39
+
40
+ Defined in: [packages/mdast-plus/src/types.ts:56](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L56)
41
+
42
+ If true, this plugin is considered the "main" plugin for its stage.
43
+ When multiple plugins exist in the same stage, a 'main' plugin will
44
+ replace the default (first) plugin of that stage.
45
+
46
+ ***
47
+
16
48
  ### name?
17
49
 
18
50
  > `optional` **name**: `string`
19
51
 
20
- Defined in: [packages/mdast-plus/src/types.ts:39](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L39)
52
+ Defined in: [packages/mdast-plus/src/types.ts:39](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L39)
21
53
 
22
54
  Optional name for the plugin.
23
55
  Used for identification in overrides and logging.
@@ -29,7 +61,7 @@ If not provided, defaults to the plugin function's name.
29
61
 
30
62
  > `optional` **options**: `any`[]
31
63
 
32
- Defined in: [packages/mdast-plus/src/types.ts:46](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L46)
64
+ Defined in: [packages/mdast-plus/src/types.ts:46](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L46)
33
65
 
34
66
  Arguments passed to the plugin.
35
67
  MUST be an array of arguments (e.g., [optionsObject]).
@@ -40,7 +72,7 @@ MUST be an array of arguments (e.g., [optionsObject]).
40
72
 
41
73
  > `optional` **order**: `number`
42
74
 
43
- Defined in: [packages/mdast-plus/src/types.ts:50](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L50)
75
+ Defined in: [packages/mdast-plus/src/types.ts:50](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L50)
44
76
 
45
77
  Execution priority within the same stage. Lower values run earlier.
46
78
 
@@ -50,7 +82,7 @@ Execution priority within the same stage. Lower values run earlier.
50
82
 
51
83
  > **plugin**: `Plugin`\<`any`[], `any`, `any`\>
52
84
 
53
- Defined in: [packages/mdast-plus/src/types.ts:41](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L41)
85
+ Defined in: [packages/mdast-plus/src/types.ts:41](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L41)
54
86
 
55
87
  The standard unified plugin (attacher) function.
56
88
 
@@ -60,6 +92,6 @@ The standard unified plugin (attacher) function.
60
92
 
61
93
  > `optional` **stage**: [`PipelineStage`](../enumerations/PipelineStage.md) \| `"parse"` \| `"normalize"` \| `"compile"` \| `"finalize"` \| `"stringify"`
62
94
 
63
- Defined in: [packages/mdast-plus/src/types.ts:48](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L48)
95
+ Defined in: [packages/mdast-plus/src/types.ts:48](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L48)
64
96
 
65
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:93](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L93)
9
+ Defined in: [packages/mdast-plus/src/types.ts:103](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L103)
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:95](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L95)
23
+ Defined in: [packages/mdast-plus/src/types.ts:105](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L105)
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:94](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L94)
68
+ Defined in: [packages/mdast-plus/src/types.ts:104](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L104)
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:99](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L99)
9
+ Defined in: [packages/mdast-plus/src/types.ts:109](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L109)
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:101](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L101)
23
+ Defined in: [packages/mdast-plus/src/types.ts:111](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L111)
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:100](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L100)
68
+ Defined in: [packages/mdast-plus/src/types.ts:110](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/types.ts#L110)
69
69
 
70
70
  Node type.
71
71
 
@@ -0,0 +1,41 @@
1
+ [**@isdk/mdast-plus**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/mdast-plus](../globals.md) / ReadabilityOptions
6
+
7
+ # Interface: ReadabilityOptions
8
+
9
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:6](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L6)
10
+
11
+ ## Properties
12
+
13
+ ### jsdom?
14
+
15
+ > `optional` **jsdom**: `Record`\<`string`, `any`\>
16
+
17
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:10](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L10)
18
+
19
+ ***
20
+
21
+ ### readability?
22
+
23
+ > `optional` **readability**: `false` \| `Record`\<`string`, `any`\>
24
+
25
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:9](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L9)
26
+
27
+ ***
28
+
29
+ ### rehype-parse?
30
+
31
+ > `optional` **rehype-parse**: `Record`\<`string`, `any`\>
32
+
33
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:11](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L11)
34
+
35
+ ***
36
+
37
+ ### url?
38
+
39
+ > `optional` **url**: `string`
40
+
41
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:8](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L8)
@@ -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/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L27)
11
+ Defined in: [packages/mdast-plus/src/types.ts:27](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/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/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/types.ts#L24)
11
+ Defined in: [packages/mdast-plus/src/types.ts:24](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/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/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/formats/ast.ts#L35)
11
+ Defined in: [packages/mdast-plus/src/formats/ast.ts:35](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/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:70](https://github.com/isdk/mdast-plus.js/blob/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/formats/html.ts#L70)
11
+ Defined in: [packages/mdast-plus/src/formats/html.ts:71](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/formats/html.ts#L71)
12
12
 
13
13
  HTML format definition.
14
14
 
@@ -0,0 +1,13 @@
1
+ [**@isdk/mdast-plus**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/mdast-plus](../globals.md) / htmlReadability
6
+
7
+ # Variable: htmlReadability
8
+
9
+ > `const` **htmlReadability**: `Plugin`\<\[[`ReadabilityOptions`](../interfaces/ReadabilityOptions.md)?\], `string`, `Root`\>
10
+
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:17](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L17)
12
+
13
+ A unified/rehype plugin that uses Mozilla's Readability to parse the input HTML.
@@ -0,0 +1,31 @@
1
+ [**@isdk/mdast-plus**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/mdast-plus](../globals.md) / htmlReadabilityPlugin
6
+
7
+ # Variable: htmlReadabilityPlugin
8
+
9
+ > `const` **htmlReadabilityPlugin**: `object`
10
+
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:79](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L79)
12
+
13
+ Pre-configured MdastPlugin for html-readability.
14
+
15
+ ## Type Declaration
16
+
17
+ ### main
18
+
19
+ > **main**: `boolean` = `true`
20
+
21
+ ### name
22
+
23
+ > **name**: `string` = `'readability'`
24
+
25
+ ### plugin
26
+
27
+ > **plugin**: `Plugin`\<\[[`ReadabilityOptions`](../interfaces/ReadabilityOptions.md)?\], `string`, `Root`\> = `htmlReadability`
28
+
29
+ ### stage
30
+
31
+ > **stage**: [`PipelineStage`](../enumerations/PipelineStage.md) = `PipelineStage.parse`
@@ -0,0 +1,13 @@
1
+ [**@isdk/mdast-plus**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/mdast-plus](../globals.md) / htmlReadabilityPlugins
6
+
7
+ # Variable: htmlReadabilityPlugins
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); \})[]
10
+
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:106](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L106)
12
+
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/bacb4922529058fef775e3f4b4e71c98ac1cab17/src/formats/markdown.ts#L103)
11
+ Defined in: [packages/mdast-plus/src/formats/markdown.ts:103](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/formats/markdown.ts#L103)
12
12
 
13
13
  Markdown format definition.
14
14
 
@@ -0,0 +1,49 @@
1
+ [**@isdk/mdast-plus**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/mdast-plus](../globals.md) / restoreReadabilityMetaPlugin
6
+
7
+ # Variable: restoreReadabilityMetaPlugin
8
+
9
+ > `const` **restoreReadabilityMetaPlugin**: `object`
10
+
11
+ Defined in: [packages/mdast-plus/src/plugins/html-readability.ts:91](https://github.com/isdk/mdast-plus.js/blob/becb4bdeb4b577bd75c7751367751e84056ff87e/src/plugins/html-readability.ts#L91)
12
+
13
+ Plugin to restore readability metadata after HAST to MDAST conversion.
14
+
15
+ ## Type Declaration
16
+
17
+ ### after
18
+
19
+ > **after**: `string` = `'rehype-remark'`
20
+
21
+ ### name
22
+
23
+ > **name**: `string` = `'restore-readability-meta'`
24
+
25
+ ### plugin()
26
+
27
+ > **plugin**: () => (`tree`, `file`) => `void`
28
+
29
+ #### Returns
30
+
31
+ > (`tree`, `file`): `void`
32
+
33
+ ##### Parameters
34
+
35
+ ###### tree
36
+
37
+ `any`
38
+
39
+ ###### file
40
+
41
+ `any`
42
+
43
+ ##### Returns
44
+
45
+ `void`
46
+
47
+ ### stage
48
+
49
+ > **stage**: [`PipelineStage`](../enumerations/PipelineStage.md) = `PipelineStage.parse`
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.1.3",
4
+ "version": "0.2.1",
5
5
  "license": "MIT",
6
6
  "author": "Riceball LEE <snowyu.lee@gmail.com>",
7
7
  "homepage": "https://github.com/isdk/mdast-plus.js",
@@ -22,8 +22,11 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
+ "@mozilla/readability": "^0.6.0",
25
26
  "ajv": "^8.17.1",
26
27
  "ajv-formats": "^3.0.1",
28
+ "hast-util-from-dom": "^5.0.1",
29
+ "hast-util-from-html": "^2.0.3",
27
30
  "hast-util-to-mdast": "^10.1.2",
28
31
  "lodash-es": "^4.17.22",
29
32
  "mdast-util-directive": "^3.1.0",
@@ -49,6 +52,9 @@
49
52
  "vfile": "^6.0.3",
50
53
  "yaml": "^2.8.2"
51
54
  },
55
+ "peerDependencies": {
56
+ "jsdom": "^27.3.0"
57
+ },
52
58
  "devDependencies": {
53
59
  "@antfu/eslint-config": "^4.10.1",
54
60
  "@apidevtools/json-schema-ref-parser": "^15.1.3",
@@ -63,6 +69,7 @@
63
69
  "eslint": "^9.34.0",
64
70
  "eslint-config-prettier": "^10.1.8",
65
71
  "eslint-plugin-tsdoc": "^0.4.0",
72
+ "jsdom": "^27.3.0",
66
73
  "json-schema-to-typescript": "^15.0.4",
67
74
  "prettier": "^3.6.2",
68
75
  "terser": "^5.44.0",