@xyd-js/content 0.0.0-build-7c0274d-20251004231821 → 0.0.0-build-ae5d7ac-20251012020134
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/CHANGELOG.md +7 -7
- package/dist/md.d.ts +4 -31
- package/dist/md.js.map +1 -1
- package/dist/vite.js.map +1 -1
- package/package.json +7 -7
- package/packages/md/index.ts +6 -1
- package/packages/md/plugins/index.ts +6 -5
- package/packages/md/plugins/mdToc.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/content",
|
|
3
|
-
"version": "0.0.0-build-
|
|
3
|
+
"version": "0.0.0-build-ae5d7ac-20251012020134",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"unist-util-visit": "^5.0.0",
|
|
39
39
|
"vfile": "^6.0.3",
|
|
40
40
|
"vfile-matter": "^5.0.1",
|
|
41
|
-
"@xyd-js/context": "0.0.0-build-
|
|
42
|
-
"@xyd-js/core": "0.0.0-build-
|
|
43
|
-
"@xyd-js/gql": "0.0.0-build-
|
|
44
|
-
"@xyd-js/openapi": "0.0.0-build-
|
|
45
|
-
"@xyd-js/sources": "0.0.0-build-
|
|
41
|
+
"@xyd-js/context": "0.0.0-build-ae5d7ac-20251012020134",
|
|
42
|
+
"@xyd-js/core": "0.0.0-build-ae5d7ac-20251012020134",
|
|
43
|
+
"@xyd-js/gql": "0.0.0-build-ae5d7ac-20251012020134",
|
|
44
|
+
"@xyd-js/openapi": "0.0.0-build-ae5d7ac-20251012020134",
|
|
45
|
+
"@xyd-js/sources": "0.0.0-build-ae5d7ac-20251012020134"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@xyd-js/components": "0.0.0-build-
|
|
48
|
+
"@xyd-js/components": "0.0.0-build-ae5d7ac-20251012020134"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.14.1",
|
package/packages/md/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Settings } from "@xyd-js/core";
|
|
2
|
+
import { Plugin } from 'unified';
|
|
2
3
|
|
|
3
4
|
import { defaultRecmaPlugins, defaultRehypePlugins, defaultRemarkPlugins } from "./plugins"
|
|
4
5
|
import { RemarkMdxTocOptions } from "./plugins/mdToc";
|
|
@@ -10,7 +11,11 @@ export type { DocSectionSchema } from "./search/types"
|
|
|
10
11
|
export async function markdownPlugins(
|
|
11
12
|
toc: RemarkMdxTocOptions, // TODO: unify this cuz it should come from core -global settings and toc options?
|
|
12
13
|
settings?: Settings
|
|
13
|
-
) {
|
|
14
|
+
): Promise<{
|
|
15
|
+
remarkPlugins: Plugin[];
|
|
16
|
+
rehypePlugins: Plugin[];
|
|
17
|
+
recmaPlugins: Plugin[];
|
|
18
|
+
}> {
|
|
14
19
|
const remarkPlugins = [...defaultRemarkPlugins(toc, settings)]
|
|
15
20
|
|
|
16
21
|
const rehypePlugins = [...(await defaultRehypePlugins(settings))]
|
|
@@ -5,6 +5,7 @@ import remarkDirective from 'remark-directive'
|
|
|
5
5
|
import rehypeRaw from 'rehype-raw';
|
|
6
6
|
import remarkMath from 'remark-math'
|
|
7
7
|
import rehypeKatex from 'rehype-katex'
|
|
8
|
+
import { Plugin } from 'unified';
|
|
8
9
|
|
|
9
10
|
import { Settings } from "@xyd-js/core";
|
|
10
11
|
|
|
@@ -28,14 +29,14 @@ import { recmaOverrideComponents } from "./recmaOverrideComponents";
|
|
|
28
29
|
export function defaultRemarkPlugins(
|
|
29
30
|
toc: RemarkMdxTocOptions,
|
|
30
31
|
settings?: Settings
|
|
31
|
-
) {
|
|
32
|
+
): Plugin[] {
|
|
32
33
|
return [
|
|
33
34
|
...thirdPartyRemarkPlugins(),
|
|
34
35
|
...remarkPlugins(toc, settings),
|
|
35
36
|
]
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
export function thirdPartyRemarkPlugins() {
|
|
39
|
+
export function thirdPartyRemarkPlugins(): Plugin[] {
|
|
39
40
|
return [
|
|
40
41
|
remarkFrontmatter,
|
|
41
42
|
remarkMdxFrontmatter,
|
|
@@ -48,7 +49,7 @@ export function thirdPartyRemarkPlugins() {
|
|
|
48
49
|
function remarkPlugins(
|
|
49
50
|
toc: RemarkMdxTocOptions,
|
|
50
51
|
settings?: Settings
|
|
51
|
-
) {
|
|
52
|
+
): Plugin[] {
|
|
52
53
|
return [
|
|
53
54
|
mdHeadingId,
|
|
54
55
|
remarkInjectCodeMeta,
|
|
@@ -64,7 +65,7 @@ function remarkPlugins(
|
|
|
64
65
|
]
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
export function includeRemarkPlugins(settings?: Settings) {
|
|
68
|
+
export function includeRemarkPlugins(settings?: Settings): Plugin[] {
|
|
68
69
|
return [
|
|
69
70
|
remarkGfm,
|
|
70
71
|
remarkDirective,
|
|
@@ -77,7 +78,7 @@ export function includeRemarkPlugins(settings?: Settings) {
|
|
|
77
78
|
]
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
export function remarkFunctionPlugins(settings?: Settings) {
|
|
81
|
+
export function remarkFunctionPlugins(settings?: Settings): Plugin[] {
|
|
81
82
|
return [
|
|
82
83
|
mdFunctionImportCode(settings),
|
|
83
84
|
mdFunctionUniform(settings),
|
|
@@ -106,7 +106,7 @@ export function remarkMdxToc(options: RemarkMdxTocOptions): Plugin {
|
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
visit(mdast, ["heading", "mdxJsxFlowElement"], (node, index) => {
|
|
109
|
+
visit(mdast, ["heading", "mdxJsxFlowElement"], (node: any, index) => {
|
|
110
110
|
// @ts-ignore
|
|
111
111
|
let depth = 0;
|
|
112
112
|
if (node.type === "mdxJsxFlowElement") {
|
|
@@ -222,7 +222,7 @@ export function remarkMdxToc(options: RemarkMdxTocOptions): Plugin {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
mdast.children.unshift(tocExport);
|
|
225
|
+
mdast.children.unshift(tocExport as any);
|
|
226
226
|
console.timeEnd('plugin:remarkMdxToc');
|
|
227
227
|
};
|
|
228
228
|
};
|