@md-plugins/vite-md-plugin 0.1.0-alpha.24 → 0.1.0-alpha.26
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 +5 -5
- package/dist/index.mjs +6 -5
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -32,12 +32,12 @@ The `viteMdPlugin` is built on top of the following plugins:
|
|
|
32
32
|
Install the plugin via your preferred package manager:
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
#
|
|
36
|
-
npm install @md-plugins/vite-md-plugin
|
|
37
|
-
# Or with Yarn:
|
|
38
|
-
yarn add @md-plugins/vite-md-plugin
|
|
39
|
-
# Or with pnpm:
|
|
35
|
+
# with pnpm:
|
|
40
36
|
pnpm add @md-plugins/vite-md-plugin
|
|
37
|
+
# with Yarn:
|
|
38
|
+
yarn add @md-plugins/vite-md-plugin
|
|
39
|
+
# with npm:
|
|
40
|
+
npm install @md-plugins/vite-md-plugin
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## Usage
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { titlePlugin } from '@md-plugins/md-plugin-title';
|
|
|
12
12
|
import { containersPlugin } from '@md-plugins/md-plugin-containers';
|
|
13
13
|
import { join } from 'node:path';
|
|
14
14
|
|
|
15
|
-
const createContainer = (container, containerType, defaultTitle) => {
|
|
15
|
+
const createContainer = (container, containerType, defaultTitle, md2) => {
|
|
16
16
|
const containerTypeLen = containerType.length;
|
|
17
17
|
return [
|
|
18
18
|
container,
|
|
@@ -23,12 +23,13 @@ const createContainer = (container, containerType, defaultTitle) => {
|
|
|
23
23
|
if (!token) {
|
|
24
24
|
return "";
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const rawTitle = token.info.trim().slice(containerTypeLen).trim() || defaultTitle;
|
|
27
|
+
const titleHtml = md2 ? md2.renderInline(rawTitle) : rawTitle;
|
|
27
28
|
if (containerType === "details") {
|
|
28
|
-
return token.nesting === 1 ? `<details class="markdown-note markdown-note--${containerType}"><summary class="markdown-note__title">${
|
|
29
|
+
return token.nesting === 1 ? `<details class="markdown-note markdown-note--${containerType}"><summary class="markdown-note__title">${titleHtml}</summary>
|
|
29
30
|
` : "</details>\n";
|
|
30
31
|
}
|
|
31
|
-
return token.nesting === 1 ? `<div class="markdown-note markdown-note--${containerType}"><p class="markdown-note__title">${
|
|
32
|
+
return token.nesting === 1 ? `<div class="markdown-note markdown-note--${containerType}"><p class="markdown-note__title">${titleHtml}</p>
|
|
32
33
|
` : "</div>\n";
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -52,7 +53,7 @@ function createMarkdownRenderer(options = {}) {
|
|
|
52
53
|
{ type: "danger", defaultTitle: "WARNING" },
|
|
53
54
|
{ type: "details", defaultTitle: "Details" }
|
|
54
55
|
];
|
|
55
|
-
md2.use(containersPlugin, containers, createContainer);
|
|
56
|
+
md2.use(containersPlugin, containers, createContainer, md2);
|
|
56
57
|
md2.use(blockquotePlugin, { blockquoteClass: "markdown-note" });
|
|
57
58
|
md2.use(tablePlugin, {
|
|
58
59
|
tableClass: "markdown-table",
|
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.26",
|
|
4
4
|
"description": "A very opinionated Vite plugin for @md-plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"markdown-it": "^14.1.0",
|
|
39
|
-
"@md-plugins/md-plugin-
|
|
40
|
-
"@md-plugins/md-plugin-
|
|
41
|
-
"@md-plugins/md-plugin-
|
|
42
|
-
"@md-plugins/md-plugin-
|
|
43
|
-
"@md-plugins/md-plugin-
|
|
44
|
-
"@md-plugins/md-plugin-
|
|
45
|
-
"@md-plugins/md-plugin-
|
|
46
|
-
"@md-plugins/md-plugin-
|
|
47
|
-
"@md-plugins/md-plugin-
|
|
48
|
-
"@md-plugins/md-plugin-table": "0.1.0-alpha.
|
|
49
|
-
"@md-plugins/
|
|
50
|
-
"@md-plugins/
|
|
39
|
+
"@md-plugins/md-plugin-blockquote": "0.1.0-alpha.26",
|
|
40
|
+
"@md-plugins/md-plugin-codeblocks": "0.1.0-alpha.26",
|
|
41
|
+
"@md-plugins/md-plugin-containers": "0.1.0-alpha.26",
|
|
42
|
+
"@md-plugins/md-plugin-frontmatter": "0.1.0-alpha.26",
|
|
43
|
+
"@md-plugins/md-plugin-headers": "0.1.0-alpha.26",
|
|
44
|
+
"@md-plugins/md-plugin-image": "0.1.0-alpha.26",
|
|
45
|
+
"@md-plugins/md-plugin-inlinecode": "0.1.0-alpha.26",
|
|
46
|
+
"@md-plugins/md-plugin-link": "0.1.0-alpha.26",
|
|
47
|
+
"@md-plugins/md-plugin-imports": "0.1.0-alpha.26",
|
|
48
|
+
"@md-plugins/md-plugin-table": "0.1.0-alpha.26",
|
|
49
|
+
"@md-plugins/shared": "0.1.0-alpha.26",
|
|
50
|
+
"@md-plugins/md-plugin-title": "0.1.0-alpha.26"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/markdown-it": "^14.1.2",
|
|
54
|
-
"vite": "^6.0
|
|
54
|
+
"vite": "^6.1.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"markdown-it": "^14.1.0"
|