@xyd-js/content 0.0.0-build-1760f84-20251129221538 → 0.0.0-build-aebf977-20251203155725
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.js +102 -44
- package/dist/md.js.map +1 -1
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +61 -9
- package/dist/vite.js.map +1 -1
- package/package.json +7 -7
- package/packages/md/plugins/index.ts +74 -4
- package/packages/md/search/index.ts +10 -5
- package/tsup.config.ts +3 -1
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-aebf977-20251203155725",
|
|
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-aebf977-20251203155725",
|
|
42
|
+
"@xyd-js/core": "0.0.0-build-aebf977-20251203155725",
|
|
43
|
+
"@xyd-js/gql": "0.0.0-build-aebf977-20251203155725",
|
|
44
|
+
"@xyd-js/openapi": "0.0.0-build-aebf977-20251203155725",
|
|
45
|
+
"@xyd-js/sources": "0.0.0-build-aebf977-20251203155725"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@xyd-js/components": "0.0.0-build-
|
|
48
|
+
"@xyd-js/components": "0.0.0-build-aebf977-20251203155725"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.14.1",
|
|
@@ -90,11 +90,75 @@ export function remarkFunctionPlugins(settings?: Settings): Plugin[] {
|
|
|
90
90
|
let rehypeMermaid
|
|
91
91
|
async function getMermaidPlugin() {
|
|
92
92
|
if (!rehypeMermaid) {
|
|
93
|
-
rehypeMermaid = (await import(
|
|
93
|
+
rehypeMermaid = (await import("rehype-mermaid")).default
|
|
94
94
|
}
|
|
95
95
|
return rehypeMermaid
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
let rehypeGraphviz
|
|
99
|
+
let graphviz
|
|
100
|
+
|
|
101
|
+
async function getGraphvizPlugin() {
|
|
102
|
+
if (!rehypeGraphviz) {
|
|
103
|
+
const graphizMod = (await import("@hpcc-js/wasm")).Graphviz
|
|
104
|
+
graphviz = await graphizMod.load()
|
|
105
|
+
|
|
106
|
+
rehypeGraphviz = (await import("rehype-graphviz")).default
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return [
|
|
110
|
+
rehypeGraphviz,
|
|
111
|
+
{
|
|
112
|
+
graphviz
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Check if a specific diagram type is enabled in settings
|
|
119
|
+
*/
|
|
120
|
+
function isDiagramTypeEnabled(settings: Settings | undefined, diagramType: 'mermaid' | 'graphviz'): boolean {
|
|
121
|
+
const diagrams = settings?.integrations?.diagrams;
|
|
122
|
+
|
|
123
|
+
if (!diagrams) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// If diagrams is just true, all types are enabled
|
|
128
|
+
if (diagrams === true) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// If diagrams is an array, check if the type is included
|
|
133
|
+
if (Array.isArray(diagrams) && diagrams.includes(diagramType)) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// If diagrams is an object, check if the type is configured
|
|
138
|
+
if (typeof diagrams === 'object' && !Array.isArray(diagrams)) {
|
|
139
|
+
if (diagramType in diagrams) {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get options for a specific diagram type from settings
|
|
149
|
+
*/
|
|
150
|
+
function getDiagramOptions(settings: Settings | undefined, diagramType: 'mermaid' | 'graphviz') {
|
|
151
|
+
const diagrams = settings?.integrations?.diagrams;
|
|
152
|
+
|
|
153
|
+
if (!diagrams || typeof diagrams !== 'object' || Array.isArray(diagrams)) {
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return diagrams[diagramType] && typeof diagrams[diagramType] === 'object'
|
|
158
|
+
? diagrams[diagramType]
|
|
159
|
+
: {};
|
|
160
|
+
}
|
|
161
|
+
|
|
98
162
|
export async function thirdPartyRehypePlugins(settings?: Settings) {
|
|
99
163
|
const plugins = [
|
|
100
164
|
[rehypeRaw, {
|
|
@@ -103,10 +167,16 @@ export async function thirdPartyRehypePlugins(settings?: Settings) {
|
|
|
103
167
|
rehypeKatex,
|
|
104
168
|
]
|
|
105
169
|
|
|
106
|
-
if
|
|
107
|
-
|
|
170
|
+
// Add mermaid plugin if enabled
|
|
171
|
+
if (isDiagramTypeEnabled(settings, 'mermaid')) {
|
|
172
|
+
const mermaidOptions = getDiagramOptions(settings, 'mermaid');
|
|
173
|
+
plugins.push([await getMermaidPlugin(), mermaidOptions])
|
|
174
|
+
}
|
|
108
175
|
|
|
109
|
-
|
|
176
|
+
// Add graphviz plugin if enabled
|
|
177
|
+
if (isDiagramTypeEnabled(settings, 'graphviz')) {
|
|
178
|
+
const graphvizPlugin = await getGraphvizPlugin()
|
|
179
|
+
plugins.push(graphvizPlugin)
|
|
110
180
|
}
|
|
111
181
|
|
|
112
182
|
return plugins
|
|
@@ -18,10 +18,14 @@ import { mdParameters } from '../plugins/utils/mdParameters'
|
|
|
18
18
|
|
|
19
19
|
export async function mapSettingsToDocSections(xydSettings: Settings) {
|
|
20
20
|
const pages = flatPages(xydSettings.navigation?.sidebar || [], {})
|
|
21
|
-
.map(page =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
.map(page => {
|
|
22
|
+
let baseName = xydSettings.advanced?.basename || ""
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
name: path.join(baseName, page),
|
|
26
|
+
path: path.join(process.cwd(), page),
|
|
27
|
+
}
|
|
28
|
+
})
|
|
25
29
|
|
|
26
30
|
return await processSections(pages, xydSettings)
|
|
27
31
|
}
|
|
@@ -76,8 +80,9 @@ export async function mapContentToDocSections(
|
|
|
76
80
|
console.error("Multiple h1 found")
|
|
77
81
|
}
|
|
78
82
|
|
|
83
|
+
const pageUrl = route.startsWith("/") ? route : `/${route}`;
|
|
79
84
|
rootSection.pageId = slug
|
|
80
|
-
rootSection.pageUrl =
|
|
85
|
+
rootSection.pageUrl = pageUrl
|
|
81
86
|
rootSection.pageTitle = heading
|
|
82
87
|
rootSection.headingLevel = 1
|
|
83
88
|
rootSection.headingTitle = heading
|
package/tsup.config.ts
CHANGED
|
@@ -24,7 +24,9 @@ const config: Options = {
|
|
|
24
24
|
// options.external = ['node:fs/promises']; // Mark 'node:fs/promises' as external
|
|
25
25
|
// options.loader = { '.js': 'jsx' }; // Ensure proper handling of .js files
|
|
26
26
|
options.external = [
|
|
27
|
-
|
|
27
|
+
"rehype-mermaid",
|
|
28
|
+
"rehype-graphviz",
|
|
29
|
+
"@hpcc-js/wasm",
|
|
28
30
|
]
|
|
29
31
|
},
|
|
30
32
|
};
|