vitepress-plugin-steps 0.1.0
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 +21 -0
- package/README.md +81 -0
- package/dist/client/style.css +62 -0
- package/dist/node/index.d.ts +9 -0
- package/dist/node/index.js +17 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pengzhanbo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# vitepress-plugin-steps
|
|
2
|
+
|
|
3
|
+
Render ordered/unordered lists as numbered steps with badges and connecting lines.
|
|
4
|
+
|
|
5
|
+
将有序/无序列表渲染为带序号和连接线的步骤样式。
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
### With Vitepress-tuck
|
|
10
|
+
|
|
11
|
+
**Installation:**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# npm
|
|
15
|
+
npm install -D vitepress-tuck vitepress-plugin-steps
|
|
16
|
+
# pnpm
|
|
17
|
+
pnpm add -D vitepress-tuck vitepress-plugin-steps
|
|
18
|
+
# yarn
|
|
19
|
+
yarn add -D vitepress-tuck vitepress-plugin-steps
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Configuration:**
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// .vitepress/config.ts
|
|
26
|
+
import steps from 'vitepress-plugin-steps'
|
|
27
|
+
import { defineConfig } from 'vitepress-tuck'
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
plugins: [steps()],
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### With Vitepress
|
|
35
|
+
|
|
36
|
+
**Installation:**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# npm
|
|
40
|
+
npm install -D vitepress-plugin-steps
|
|
41
|
+
# pnpm
|
|
42
|
+
pnpm add -D vitepress-plugin-steps
|
|
43
|
+
# yarn
|
|
44
|
+
yarn add -D vitepress-plugin-steps
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Configuration:**
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// .vitepress/config.ts
|
|
51
|
+
import { defineConfig } from 'vitepress'
|
|
52
|
+
import { stepsMarkdownPlugin } from 'vitepress-plugin-steps'
|
|
53
|
+
|
|
54
|
+
export default defineConfig({
|
|
55
|
+
markdown: {
|
|
56
|
+
config: (md) => {
|
|
57
|
+
md.use(stepsMarkdownPlugin)
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
// .vitepress/theme/index.ts
|
|
65
|
+
import 'vitepress-plugin-steps/style.css'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Syntax
|
|
69
|
+
|
|
70
|
+
Use `::: steps` container to create step-by-step instructions.
|
|
71
|
+
|
|
72
|
+
```md
|
|
73
|
+
::: steps
|
|
74
|
+
1. First, clone the repository
|
|
75
|
+
2. Then, install dependencies
|
|
76
|
+
3. Finally, start the dev server
|
|
77
|
+
:::
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Each list item is rendered with a numbered circle badge and vertical connecting lines between steps.
|
|
81
|
+
Supports all standard Markdown syntax (headings, paragraphs, code blocks, etc.) inside each step.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.vp-doc .vp-steps {
|
|
2
|
+
margin-block: 16px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.vp-doc .vp-steps > :where(ol,ul) {
|
|
6
|
+
padding-inline-start: 0;
|
|
7
|
+
list-style: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vp-doc .vp-steps > :where(ol,ul) > li {
|
|
11
|
+
position: relative;
|
|
12
|
+
min-height: 28px;
|
|
13
|
+
padding-inline-start: 44px;
|
|
14
|
+
margin-block-end: 16px;
|
|
15
|
+
line-height: 28px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.vp-doc .vp-steps > :where(ol,ul) > li::before {
|
|
19
|
+
position: absolute;
|
|
20
|
+
inset-block-start: 0;
|
|
21
|
+
inset-inline-start: 0;
|
|
22
|
+
width: 28px;
|
|
23
|
+
height: 28px;
|
|
24
|
+
font-size: 16px;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
line-height: 28px;
|
|
27
|
+
color: var(--vp-c-text-1);
|
|
28
|
+
text-align: center;
|
|
29
|
+
content: counter(list-item);
|
|
30
|
+
background-color: var(--vp-c-bg-soft);
|
|
31
|
+
border: solid 1px var(--vp-c-divider);
|
|
32
|
+
border-radius: 100%;
|
|
33
|
+
transition: 0.3s ease;
|
|
34
|
+
transition-property: color, background-color, border-color;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.vp-doc .vp-steps > :where(ol,ul) > li:not(:last-of-type)::after {
|
|
38
|
+
position: absolute;
|
|
39
|
+
inset-block: 34px -10px;
|
|
40
|
+
inset-inline-start: 14px;
|
|
41
|
+
width: 1px;
|
|
42
|
+
content: "";
|
|
43
|
+
background-color: var(--vp-c-divider);
|
|
44
|
+
transition: background-color 0.3s ease;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.vp-doc .vp-steps > :where(ol,ul) > li > :first-child {
|
|
48
|
+
margin-block-start: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.vp-doc .vp-steps > :where(ol,ul) > li > :first-child:where(h1,h2,h3,h4,h5,h6) {
|
|
52
|
+
padding-block-start: 0;
|
|
53
|
+
border-block-start: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.vp-doc .vp-steps > :where(ol,ul) > li > :first-child:where(p) {
|
|
57
|
+
line-height: 28px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.vp-doc .vp-steps > :where(ol,ul) > li + li {
|
|
61
|
+
margin-block-start: 1px;
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginSimple } from "markdown-it";
|
|
2
|
+
|
|
3
|
+
//#region src/node/stepsPlugin.d.ts
|
|
4
|
+
declare const stepsMarkdownPlugin: PluginSimple;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/node/index.d.ts
|
|
7
|
+
declare const _default: (option?: unknown) => import("vitepress-tuck").VitepressPlugin;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { _default as default, stepsMarkdownPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { definePlugin } from "vitepress-tuck";
|
|
2
|
+
import { createContainerPlugin } from "vitepress-plugin-toolkit";
|
|
3
|
+
//#region src/node/stepsPlugin.ts
|
|
4
|
+
const stepsMarkdownPlugin = (md) => {
|
|
5
|
+
createContainerPlugin(md, "steps", { before: () => "<div class=\"vp-steps\">" });
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/node/index.ts
|
|
9
|
+
var node_default = definePlugin(() => ({
|
|
10
|
+
name: "vitepress-plugin-steps",
|
|
11
|
+
client: { imports: [`import 'vitepress-plugin-steps/style.css'`] },
|
|
12
|
+
markdown: { config: (md) => {
|
|
13
|
+
md.use(stepsMarkdownPlugin);
|
|
14
|
+
} }
|
|
15
|
+
}));
|
|
16
|
+
//#endregion
|
|
17
|
+
export { node_default as default, stepsMarkdownPlugin };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vitepress-plugin-steps",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Render ordered/unordered lists as numbered steps with badges and connecting lines.",
|
|
6
|
+
"author": "pengzhanbo <q942450674@outlook.com> (https://github.com/pengzhanbo/)",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"vitepress",
|
|
10
|
+
"vitepress-plugin",
|
|
11
|
+
"steps"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/node/index.d.ts",
|
|
16
|
+
"default": "./dist/node/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./style.css": "./dist/client/style.css"
|
|
19
|
+
},
|
|
20
|
+
"module": "./dist/node/index.js",
|
|
21
|
+
"types": "./dist/node/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"vitepress": "^1.6.4 || ^2.0.0-alpha.17",
|
|
27
|
+
"vue": "^3.5.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"vitepress-tuck": "0.1.0",
|
|
31
|
+
"vitepress-plugin-toolkit": "0.1.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean": "rimraf --glob ./dist",
|
|
38
|
+
"dev": "pnpm '/(tsdown|copy):watch/'",
|
|
39
|
+
"build": "pnpm tsdown && pnpm copy",
|
|
40
|
+
"copy": "cpx \"src/**/*.css\" dist",
|
|
41
|
+
"copy:watch": "pnpm copy -w",
|
|
42
|
+
"tsdown": "tsdown --config-loader unrun",
|
|
43
|
+
"tsdown:watch": "pnpm tsdown -w"
|
|
44
|
+
}
|
|
45
|
+
}
|