@md-plugins/vite-md-plugin 0.1.0-alpha.7 → 0.1.0-alpha.8
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/README.md +8 -2
- package/dist/index.d.mts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.mjs +6 -7
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ const menu = [] // Define your navigation menu structure here
|
|
|
55
55
|
const basePath = '/docs' // Base path prefix
|
|
56
56
|
|
|
57
57
|
export default defineConfig({
|
|
58
|
-
plugins: [vue(), viteMdPlugin(basePath, menu)],
|
|
58
|
+
plugins: [vue(), viteMdPlugin({ path: basePath, menu })],
|
|
59
59
|
})
|
|
60
60
|
```
|
|
61
61
|
|
|
@@ -82,7 +82,13 @@ build: {
|
|
|
82
82
|
},
|
|
83
83
|
|
|
84
84
|
vitePlugins: [
|
|
85
|
-
|
|
85
|
+
[
|
|
86
|
+
viteMdPlugin,
|
|
87
|
+
{
|
|
88
|
+
path: ctx.appPaths.srcDir + '/markdown',
|
|
89
|
+
menu: sidebar as MenuItem[],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
86
92
|
// ...
|
|
87
93
|
],
|
|
88
94
|
},
|
package/dist/index.d.mts
CHANGED
|
@@ -34,15 +34,20 @@ interface RelatedItem {
|
|
|
34
34
|
category: string;
|
|
35
35
|
path: string;
|
|
36
36
|
}
|
|
37
|
+
interface UserConfig {
|
|
38
|
+
path: string;
|
|
39
|
+
menu: MenuItem[];
|
|
40
|
+
}
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
|
-
* Creates a Vite plugin for processing Markdown files.
|
|
40
|
-
* This plugin transforms Markdown content into Vue Single File Components (SFCs).
|
|
43
|
+
* Creates a Vite plugin for processing Markdown files based on the provided user configuration.
|
|
44
|
+
* This function configures and returns a plugin that transforms Markdown content into Vue Single File Components (SFCs).
|
|
41
45
|
*
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @
|
|
46
|
+
* @param userConfig - The configuration object for the Vite Markdown plugin.
|
|
47
|
+
* @param userConfig.path - The base path prefix to be used for routing or file resolution.
|
|
48
|
+
* @param userConfig.menu - An array of MenuItem objects representing the navigation menu structure.
|
|
49
|
+
* @returns A Vite Plugin object pre-configured with the provided settings for Markdown processing.
|
|
45
50
|
*/
|
|
46
|
-
declare function viteMdPlugin(
|
|
51
|
+
declare function viteMdPlugin(userConfig: UserConfig): Plugin;
|
|
47
52
|
|
|
48
|
-
export { type FlatMenu, type FlatMenuEntry, type MenuItem, type MenuNode, type NavItem, type RelatedItem, viteMdPlugin };
|
|
53
|
+
export { type FlatMenu, type FlatMenuEntry, type MenuItem, type MenuNode, type NavItem, type RelatedItem, type UserConfig, viteMdPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -34,15 +34,20 @@ interface RelatedItem {
|
|
|
34
34
|
category: string;
|
|
35
35
|
path: string;
|
|
36
36
|
}
|
|
37
|
+
interface UserConfig {
|
|
38
|
+
path: string;
|
|
39
|
+
menu: MenuItem[];
|
|
40
|
+
}
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
|
-
* Creates a Vite plugin for processing Markdown files.
|
|
40
|
-
* This plugin transforms Markdown content into Vue Single File Components (SFCs).
|
|
43
|
+
* Creates a Vite plugin for processing Markdown files based on the provided user configuration.
|
|
44
|
+
* This function configures and returns a plugin that transforms Markdown content into Vue Single File Components (SFCs).
|
|
41
45
|
*
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @
|
|
46
|
+
* @param userConfig - The configuration object for the Vite Markdown plugin.
|
|
47
|
+
* @param userConfig.path - The base path prefix to be used for routing or file resolution.
|
|
48
|
+
* @param userConfig.menu - An array of MenuItem objects representing the navigation menu structure.
|
|
49
|
+
* @returns A Vite Plugin object pre-configured with the provided settings for Markdown processing.
|
|
45
50
|
*/
|
|
46
|
-
declare function viteMdPlugin(
|
|
51
|
+
declare function viteMdPlugin(userConfig: UserConfig): Plugin;
|
|
47
52
|
|
|
48
|
-
export { type FlatMenu, type FlatMenuEntry, type MenuItem, type MenuNode, type NavItem, type RelatedItem, viteMdPlugin };
|
|
53
|
+
export { type FlatMenu, type FlatMenuEntry, type MenuItem, type MenuNode, type NavItem, type RelatedItem, type UserConfig, viteMdPlugin };
|
package/dist/index.mjs
CHANGED
|
@@ -209,7 +209,7 @@ function getVueComponent(rendered, code, id, prefix, menu) {
|
|
|
209
209
|
}
|
|
210
210
|
const frontmatter = rendered?.frontmatter || {};
|
|
211
211
|
if (frontmatter.editLink !== false) {
|
|
212
|
-
frontmatter.editLink = id.substring(id.indexOf("src/markdown/") +
|
|
212
|
+
frontmatter.editLink = id.substring(id.indexOf("src/markdown/") + 13, id.length - 3);
|
|
213
213
|
}
|
|
214
214
|
const title = frontmatter.title || rendered.env.title || rendered.title || "Generic Page";
|
|
215
215
|
const desc = frontmatter.desc || false;
|
|
@@ -221,7 +221,6 @@ function getVueComponent(rendered, code, id, prefix, menu) {
|
|
|
221
221
|
const badge = frontmatter.badge || false;
|
|
222
222
|
const toc = rendered.env.toc || false;
|
|
223
223
|
const editLink = frontmatter.editLink || false;
|
|
224
|
-
frontmatter.components || false;
|
|
225
224
|
const scope = frontmatter.scope || false;
|
|
226
225
|
const examples = frontmatter.examples || false;
|
|
227
226
|
const { mdContent, userScripts } = splitRenderedContent(rendered.html);
|
|
@@ -327,23 +326,23 @@ function hotUpdate({
|
|
|
327
326
|
server.ws.send({
|
|
328
327
|
type: "full-reload",
|
|
329
328
|
path: file
|
|
330
|
-
// '*',
|
|
331
329
|
});
|
|
332
330
|
}
|
|
333
331
|
return [];
|
|
334
332
|
}
|
|
335
333
|
const mdPlugins = {
|
|
336
|
-
name: "md-plugins
|
|
334
|
+
name: "@md-plugins/vite-md-plugin",
|
|
337
335
|
enforce: "pre",
|
|
338
|
-
// before vue
|
|
339
336
|
transform,
|
|
340
|
-
// handleHotUpdate,
|
|
341
337
|
hotUpdate
|
|
342
338
|
};
|
|
343
|
-
function
|
|
339
|
+
function viteMdPlugin2(path, menu) {
|
|
344
340
|
globalMenu = menu;
|
|
345
341
|
globalPrefix = path;
|
|
346
342
|
return mdPlugins;
|
|
347
343
|
}
|
|
344
|
+
function viteMdPlugin(userConfig) {
|
|
345
|
+
return viteMdPlugin2(userConfig.path, userConfig.menu);
|
|
346
|
+
}
|
|
348
347
|
|
|
349
348
|
export { viteMdPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@md-plugins/vite-md-plugin",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"description": "A very opinionated Vite plugin for @md-plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
"./dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@md-plugins/md-plugin-
|
|
39
|
-
"@md-plugins/md-plugin-
|
|
40
|
-
"@md-plugins/md-plugin-
|
|
41
|
-
"@md-plugins/md-plugin-
|
|
42
|
-
"@md-plugins/md-plugin-headers": "0.1.0-alpha.
|
|
43
|
-
"@md-plugins/md-plugin-
|
|
44
|
-
"@md-plugins/md-plugin-
|
|
45
|
-
"@md-plugins/md-plugin-inlinecode": "0.1.0-alpha.
|
|
46
|
-
"@md-plugins/md-plugin-link": "0.1.0-alpha.
|
|
47
|
-
"@md-plugins/md-plugin-table": "0.1.0-alpha.
|
|
48
|
-
"@md-plugins/shared": "0.1.0-alpha.
|
|
49
|
-
"@md-plugins/md-plugin-title": "0.1.0-alpha.
|
|
38
|
+
"@md-plugins/md-plugin-codeblocks": "0.1.0-alpha.8",
|
|
39
|
+
"@md-plugins/md-plugin-frontmatter": "0.1.0-alpha.8",
|
|
40
|
+
"@md-plugins/md-plugin-containers": "0.1.0-alpha.8",
|
|
41
|
+
"@md-plugins/md-plugin-image": "0.1.0-alpha.8",
|
|
42
|
+
"@md-plugins/md-plugin-headers": "0.1.0-alpha.8",
|
|
43
|
+
"@md-plugins/md-plugin-imports": "0.1.0-alpha.8",
|
|
44
|
+
"@md-plugins/md-plugin-blockquote": "0.1.0-alpha.8",
|
|
45
|
+
"@md-plugins/md-plugin-inlinecode": "0.1.0-alpha.8",
|
|
46
|
+
"@md-plugins/md-plugin-link": "0.1.0-alpha.8",
|
|
47
|
+
"@md-plugins/md-plugin-table": "0.1.0-alpha.8",
|
|
48
|
+
"@md-plugins/shared": "0.1.0-alpha.8",
|
|
49
|
+
"@md-plugins/md-plugin-title": "0.1.0-alpha.8"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/markdown-it": "^14.1.2",
|