@md-plugins/md-plugin-imports 0.1.0-alpha.1 → 0.1.0-alpha.2
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/LICENSE.md +1 -1
- package/README.md +3 -3
- package/dist/index.mjs +1 -3
- package/package.json +3 -3
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024-present,
|
|
3
|
+
Copyright (c) 2024-present, MD-PLUGINS
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ The `md-plugin-imports` plugin does not currently accept options. All `<script i
|
|
|
62
62
|
|
|
63
63
|
The plugin recognizes `<script import>` blocks in the following format:
|
|
64
64
|
|
|
65
|
-
```
|
|
65
|
+
```markup
|
|
66
66
|
<script import>
|
|
67
67
|
import A from './A.vue';
|
|
68
68
|
import B from './B.vue';
|
|
@@ -80,7 +80,7 @@ import B from './B.vue';
|
|
|
80
80
|
|
|
81
81
|
The plugin supports multiple `<script import>` blocks in a single Markdown file:
|
|
82
82
|
|
|
83
|
-
```
|
|
83
|
+
```markup
|
|
84
84
|
<script import>
|
|
85
85
|
import A from './A.vue';
|
|
86
86
|
</script>
|
|
@@ -98,7 +98,7 @@ Both `import A from './A.vue';` and `import B from './B.vue';` will be added to
|
|
|
98
98
|
|
|
99
99
|
The plugin does not interfere with frontmatter or other Markdown content:
|
|
100
100
|
|
|
101
|
-
```
|
|
101
|
+
```markup
|
|
102
102
|
---
|
|
103
103
|
title: Frontmatter Example
|
|
104
104
|
---
|
package/dist/index.mjs
CHANGED
|
@@ -2,9 +2,7 @@ const scriptRE = /^\s*<script import>\n([\s\S]*?)\n\s*<\/script>/gm;
|
|
|
2
2
|
const importsPlugin = (md) => {
|
|
3
3
|
const render = md.render.bind(md);
|
|
4
4
|
md.render = (src, env = {}) => {
|
|
5
|
-
|
|
6
|
-
env.pageScripts = /* @__PURE__ */ new Set();
|
|
7
|
-
}
|
|
5
|
+
env.pageScripts = env.pageScripts || /* @__PURE__ */ new Set();
|
|
8
6
|
const mdContent = src.replace(scriptRE, (_, scriptContent) => {
|
|
9
7
|
const imports = scriptContent.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
10
8
|
imports.forEach((importLine) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@md-plugins/md-plugin-imports",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
4
|
"description": "A markdown-it plugin for handling imports in markdown files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@types/markdown-it": "^14.1.2",
|
|
37
37
|
"markdown-it": "^14.1.0",
|
|
38
|
-
"@md-plugins/shared": "0.1.0-alpha.
|
|
38
|
+
"@md-plugins/shared": "0.1.0-alpha.2"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild",
|
|
45
|
-
"clean": "rm -rf dist",
|
|
45
|
+
"clean": "rm -rf dist/ node_modules/",
|
|
46
46
|
"test": "vitest"
|
|
47
47
|
}
|
|
48
48
|
}
|