diff --git a/example/docs/zh-CN/components/animation.md b/example/docs/zh-CN/components/animation.md index 9980d4d4..6483a4c9 100644 --- a/example/docs/zh-CN/components/animation.md +++ b/example/docs/zh-CN/components/animation.md @@ -97,4 +97,7 @@ export default { ::: ::: comment +::: + +::: previousNext animation ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/avatar.md b/example/docs/zh-CN/components/avatar.md index ca80adf5..a5c88dc4 100644 --- a/example/docs/zh-CN/components/avatar.md +++ b/example/docs/zh-CN/components/avatar.md @@ -97,4 +97,7 @@ export default { ::: ::: comment +::: + +::: previousNext avatar ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/backtop.md b/example/docs/zh-CN/components/backtop.md index d7613aeb..af4c9fb5 100644 --- a/example/docs/zh-CN/components/backtop.md +++ b/example/docs/zh-CN/components/backtop.md @@ -120,3 +120,6 @@ export default { | default| 自定义内容 | ::: + +::: previousNext backtop +::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/badge.md b/example/docs/zh-CN/components/badge.md index 72563b1e..7344f781 100644 --- a/example/docs/zh-CN/components/badge.md +++ b/example/docs/zh-CN/components/badge.md @@ -63,4 +63,7 @@ export default { ::: ::: comment +::: + +::: previousNext badge ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/block.md b/example/docs/zh-CN/components/block.md index cf366eb1..7ecef799 100644 --- a/example/docs/zh-CN/components/block.md +++ b/example/docs/zh-CN/components/block.md @@ -62,4 +62,7 @@ export default { ::: ::: comment +::: + +::: previousNext block ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/breadcrumb.md b/example/docs/zh-CN/components/breadcrumb.md index 9dca4890..0a10cd58 100644 --- a/example/docs/zh-CN/components/breadcrumb.md +++ b/example/docs/zh-CN/components/breadcrumb.md @@ -105,4 +105,7 @@ export default { ::: ::: comment +::: + +::: previousNext breadcrumb ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/button.md b/example/docs/zh-CN/components/button.md index 1908d39a..9f4e0d8b 100644 --- a/example/docs/zh-CN/components/button.md +++ b/example/docs/zh-CN/components/button.md @@ -337,3 +337,6 @@ export default { ::: comment ::: + +::: previousNext button +::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/card.md b/example/docs/zh-CN/components/card.md index ee659100..d143b499 100644 --- a/example/docs/zh-CN/components/card.md +++ b/example/docs/zh-CN/components/card.md @@ -133,4 +133,7 @@ export default { ::: ::: comment +::: + +::: previousNext card ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/carousel.md b/example/docs/zh-CN/components/carousel.md index 5d973b26..34cb7e08 100644 --- a/example/docs/zh-CN/components/carousel.md +++ b/example/docs/zh-CN/components/carousel.md @@ -144,4 +144,7 @@ export default { ::: ::: comment +::: + +::: previousNext carousel ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/checkbox.md b/example/docs/zh-CN/components/checkbox.md index bde533f0..46eb88ea 100644 --- a/example/docs/zh-CN/components/checkbox.md +++ b/example/docs/zh-CN/components/checkbox.md @@ -215,4 +215,7 @@ export default { ::: ::: comment +::: + +::: previousNext checkbox ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/collapse.md b/example/docs/zh-CN/components/collapse.md index 38a51b7f..123aa229 100644 --- a/example/docs/zh-CN/components/collapse.md +++ b/example/docs/zh-CN/components/collapse.md @@ -211,4 +211,7 @@ export default { ::: ::: comment +::: + +::: previousNext collapse ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/color.md b/example/docs/zh-CN/components/color.md index 786ba741..41f08b37 100644 --- a/example/docs/zh-CN/components/color.md +++ b/example/docs/zh-CN/components/color.md @@ -165,4 +165,7 @@ export default { ::: ::: comment +::: + +::: previousNext color ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/colorPicker.md b/example/docs/zh-CN/components/colorPicker.md index d60f63a8..17909e6c 100644 --- a/example/docs/zh-CN/components/colorPicker.md +++ b/example/docs/zh-CN/components/colorPicker.md @@ -33,4 +33,7 @@ export default { ::: ::: comment +::: + +::: previousNext colorPicker ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/confirm.md b/example/docs/zh-CN/components/confirm.md index fce0b3c4..2ecce930 100644 --- a/example/docs/zh-CN/components/confirm.md +++ b/example/docs/zh-CN/components/confirm.md @@ -78,4 +78,7 @@ layer.confirm(content, options) ::: ::: comment +::: + +::: previousNext confirm ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/container.md b/example/docs/zh-CN/components/container.md index f6bba2c4..5df64856 100644 --- a/example/docs/zh-CN/components/container.md +++ b/example/docs/zh-CN/components/container.md @@ -80,4 +80,7 @@ export default { ::: ::: comment +::: + +::: previousNext container ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/countup.md b/example/docs/zh-CN/components/countup.md index 6641070f..1a1213eb 100644 --- a/example/docs/zh-CN/components/countup.md +++ b/example/docs/zh-CN/components/countup.md @@ -123,4 +123,7 @@ export default { | prefix | 前缀 | -- | | suffix | 后缀 | -- | +::: + +::: previousNext countUp ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/datePicker.md b/example/docs/zh-CN/components/datePicker.md index 404a7e9b..7e7213a5 100644 --- a/example/docs/zh-CN/components/datePicker.md +++ b/example/docs/zh-CN/components/datePicker.md @@ -24,3 +24,6 @@ export default { ::: + +::: previousNext datePicker +::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/dropdown.md b/example/docs/zh-CN/components/dropdown.md index 3a695964..3413caaf 100644 --- a/example/docs/zh-CN/components/dropdown.md +++ b/example/docs/zh-CN/components/dropdown.md @@ -93,4 +93,7 @@ export default { ::: ::: comment +::: + +::: previousNext dropdown ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/empty.md b/example/docs/zh-CN/components/empty.md index 2d2be4af..08ba3fd2 100644 --- a/example/docs/zh-CN/components/empty.md +++ b/example/docs/zh-CN/components/empty.md @@ -59,4 +59,7 @@ export default { ::: ::: comment +::: + +::: previousNext empty ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/field.md b/example/docs/zh-CN/components/field.md index 6cd334b4..475f5c16 100644 --- a/example/docs/zh-CN/components/field.md +++ b/example/docs/zh-CN/components/field.md @@ -76,4 +76,7 @@ export default { ::: ::: comment +::: + +::: previousNext field ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/form.md b/example/docs/zh-CN/components/form.md index 00b6f830..c577d1d3 100644 --- a/example/docs/zh-CN/components/form.md +++ b/example/docs/zh-CN/components/form.md @@ -581,4 +581,7 @@ export default { ::: comment +::: + +::: previousNext form ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/grid.md b/example/docs/zh-CN/components/grid.md index e149113f..f276676f 100644 --- a/example/docs/zh-CN/components/grid.md +++ b/example/docs/zh-CN/components/grid.md @@ -169,4 +169,7 @@ export default { ::: ::: comment +::: + +::: previousNext grid ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/icon.md b/example/docs/zh-CN/components/icon.md index f8224f70..1637b994 100644 --- a/example/docs/zh-CN/components/icon.md +++ b/example/docs/zh-CN/components/icon.md @@ -1132,4 +1132,7 @@ npm install @layui/icons-vue ::: ::: comment +::: + +::: previousNext iconfont ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/iconPicker.md b/example/docs/zh-CN/components/iconPicker.md index 3e8ab2cc..979a6b8a 100644 --- a/example/docs/zh-CN/components/iconPicker.md +++ b/example/docs/zh-CN/components/iconPicker.md @@ -115,4 +115,7 @@ export default { ::: ::: comment +::: + +::: previousNext iconPicker ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/input.md b/example/docs/zh-CN/components/input.md index 3493612f..0247562c 100644 --- a/example/docs/zh-CN/components/input.md +++ b/example/docs/zh-CN/components/input.md @@ -134,4 +134,7 @@ export default { ::: ::: comment +::: + +::: previousNext input ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/inputNumber.md b/example/docs/zh-CN/components/inputNumber.md index e4d88717..fe3d5de6 100644 --- a/example/docs/zh-CN/components/inputNumber.md +++ b/example/docs/zh-CN/components/inputNumber.md @@ -142,4 +142,7 @@ ::: ::: comment +::: + +::: previousNext inputNumber ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/layout.md b/example/docs/zh-CN/components/layout.md index 54e9388d..5544d6fa 100644 --- a/example/docs/zh-CN/components/layout.md +++ b/example/docs/zh-CN/components/layout.md @@ -189,4 +189,7 @@ export default { ::: ::: comment +::: + +::: previousNext layout ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/line.md b/example/docs/zh-CN/components/line.md index ebe7eb2a..4c441ba6 100644 --- a/example/docs/zh-CN/components/line.md +++ b/example/docs/zh-CN/components/line.md @@ -49,4 +49,7 @@ export default { ::: ::: comment +::: + +::: previousNext line ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/load.md b/example/docs/zh-CN/components/load.md index 07bf855b..d2ec6a65 100644 --- a/example/docs/zh-CN/components/load.md +++ b/example/docs/zh-CN/components/load.md @@ -128,4 +128,7 @@ layer.load(load, options) ::: ::: comment +::: + +::: previousNext load ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/menu.md b/example/docs/zh-CN/components/menu.md index 7ffac7fa..603c0883 100644 --- a/example/docs/zh-CN/components/menu.md +++ b/example/docs/zh-CN/components/menu.md @@ -160,4 +160,7 @@ export default { ::: ::: comment +::: + +::: previousNext nav ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/modal.md b/example/docs/zh-CN/components/modal.md index 49e73f39..125d4711 100644 --- a/example/docs/zh-CN/components/modal.md +++ b/example/docs/zh-CN/components/modal.md @@ -343,4 +343,7 @@ export default { ::: ::: comment +::: + +::: previousNext modal ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/msg.md b/example/docs/zh-CN/components/msg.md index 401823e7..6736383c 100644 --- a/example/docs/zh-CN/components/msg.md +++ b/example/docs/zh-CN/components/msg.md @@ -96,4 +96,7 @@ layer.msg(content, options) ::: ::: comment +::: + +::: previousNext msg ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/page.md b/example/docs/zh-CN/components/page.md index 618326c2..3b6e1223 100644 --- a/example/docs/zh-CN/components/page.md +++ b/example/docs/zh-CN/components/page.md @@ -237,4 +237,7 @@ export default { ::: ::: comment +::: + +::: previousNext page ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/panel.md b/example/docs/zh-CN/components/panel.md index b9a17e75..6b896b96 100644 --- a/example/docs/zh-CN/components/panel.md +++ b/example/docs/zh-CN/components/panel.md @@ -36,4 +36,7 @@ export default { ::: ::: comment +::: + +::: previousNext panel ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/progress.md b/example/docs/zh-CN/components/progress.md index 4a3424dc..2381668c 100644 --- a/example/docs/zh-CN/components/progress.md +++ b/example/docs/zh-CN/components/progress.md @@ -130,4 +130,7 @@ export default { ::: ::: comment +::: + +::: previousNext progress ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/radio.md b/example/docs/zh-CN/components/radio.md index 0d194a60..603fd94d 100644 --- a/example/docs/zh-CN/components/radio.md +++ b/example/docs/zh-CN/components/radio.md @@ -122,4 +122,7 @@ export default { ::: ::: comment +::: + +::: previousNext radio ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/rate.md b/example/docs/zh-CN/components/rate.md index 25e3c459..06c5780a 100644 --- a/example/docs/zh-CN/components/rate.md +++ b/example/docs/zh-CN/components/rate.md @@ -310,4 +310,7 @@ export default { ::: ::: comment +::: + +::: previousNext rate ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/select.md b/example/docs/zh-CN/components/select.md index 5544ef36..e0c2c212 100644 --- a/example/docs/zh-CN/components/select.md +++ b/example/docs/zh-CN/components/select.md @@ -151,4 +151,7 @@ export default { ::: ::: comment +::: + +::: previousNext select ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/skeleton.md b/example/docs/zh-CN/components/skeleton.md index fff07bf1..b91910e4 100644 --- a/example/docs/zh-CN/components/skeleton.md +++ b/example/docs/zh-CN/components/skeleton.md @@ -109,4 +109,7 @@ export default { ::: ::: comment +::: + +::: previousNext skeleton ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/slider.md b/example/docs/zh-CN/components/slider.md index 39661b4e..0e3650c1 100644 --- a/example/docs/zh-CN/components/slider.md +++ b/example/docs/zh-CN/components/slider.md @@ -108,3 +108,6 @@ export default { ::: comment ::: + +::: previousNext slider +::: diff --git a/example/docs/zh-CN/components/step.md b/example/docs/zh-CN/components/step.md index b34c0dbb..753e185f 100644 --- a/example/docs/zh-CN/components/step.md +++ b/example/docs/zh-CN/components/step.md @@ -470,4 +470,7 @@ export default { ::: ::: comment +::: + +::: previousNext step ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/switch.md b/example/docs/zh-CN/components/switch.md index f391b3ed..e7fe8129 100644 --- a/example/docs/zh-CN/components/switch.md +++ b/example/docs/zh-CN/components/switch.md @@ -138,4 +138,7 @@ export default { ::: ::: comment +::: + +::: previousNext switch ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/tab.md b/example/docs/zh-CN/components/tab.md index 8af7bfac..cfdb783a 100644 --- a/example/docs/zh-CN/components/tab.md +++ b/example/docs/zh-CN/components/tab.md @@ -248,4 +248,7 @@ export default { ::: ::: comment +::: + +::: previousNext tab ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/table.md b/example/docs/zh-CN/components/table.md index 6ff3bdc9..5abe851b 100644 --- a/example/docs/zh-CN/components/table.md +++ b/example/docs/zh-CN/components/table.md @@ -331,3 +331,6 @@ export default { ::: comment ::: + +::: previousNext table +::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/textarea.md b/example/docs/zh-CN/components/textarea.md index 13d4a7f0..97f00bfc 100644 --- a/example/docs/zh-CN/components/textarea.md +++ b/example/docs/zh-CN/components/textarea.md @@ -113,4 +113,7 @@ export default { ::: ::: comment +::: + +::: previousNext textarea ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/timeline.md b/example/docs/zh-CN/components/timeline.md index f52cb769..285a0a7e 100644 --- a/example/docs/zh-CN/components/timeline.md +++ b/example/docs/zh-CN/components/timeline.md @@ -132,4 +132,7 @@ export default { ::: ::: comment +::: + +::: previousNext timeline ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/tooltip.md b/example/docs/zh-CN/components/tooltip.md index 1ba1d14b..d57ccd1b 100644 --- a/example/docs/zh-CN/components/tooltip.md +++ b/example/docs/zh-CN/components/tooltip.md @@ -130,4 +130,7 @@ ::: ::: comment +::: + +::: previousNext tooltip ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/transfer.md b/example/docs/zh-CN/components/transfer.md index 0af76e89..6d7a7b15 100644 --- a/example/docs/zh-CN/components/transfer.md +++ b/example/docs/zh-CN/components/transfer.md @@ -111,4 +111,7 @@ export default { ::: ::: comment +::: + +::: previousNext transfer ::: \ No newline at end of file diff --git a/example/docs/zh-CN/components/tree.md b/example/docs/zh-CN/components/tree.md index 1ff6ca5c..0e4852fd 100644 --- a/example/docs/zh-CN/components/tree.md +++ b/example/docs/zh-CN/components/tree.md @@ -258,4 +258,7 @@ function handleClick(node) { ::: ::: comment +::: + +::: previousNext tree ::: \ No newline at end of file diff --git a/example/src/assets/css/markdown.css b/example/src/assets/css/markdown.css index db461523..7c6ba477 100644 --- a/example/src/assets/css/markdown.css +++ b/example/src/assets/css/markdown.css @@ -265,3 +265,6 @@ body::-webkit-scrollbar { .layui-menu .layui-menu-item-group > .layui-menu-body-title { padding-left: 15px; } +.lay-link:hover{ + color: #5FB878; +} \ No newline at end of file diff --git a/example/src/plugin/common-plugins.ts b/example/src/plugin/common-plugins.ts index 7b4e0839..c2dc908e 100644 --- a/example/src/plugin/common-plugins.ts +++ b/example/src/plugin/common-plugins.ts @@ -1,16 +1,17 @@ -import vue from '@vitejs/plugin-vue' -import Markdown from 'vite-plugin-md' -import container from 'markdown-it-container' -import highlight from './highlight' -import snippet from './snippet' -import demo from './demo' -import createTitle from './create-title' -import createBlock from './create-block' -import createDescribe from './create-describe' -import createTable from './create-table' -import createComment from './create-comment' -import createAnchor from './create-anchor' -import preWrapper from './pre-wrapper' +import vue from "@vitejs/plugin-vue"; +import Markdown from "vite-plugin-md"; +import container from "markdown-it-container"; +import highlight from "./highlight"; +import snippet from "./snippet"; +import demo from "./demo"; +import createTitle from "./create-title"; +import createBlock from "./create-block"; +import createDescribe from "./create-describe"; +import createTable from "./create-table"; +import createComment from "./create-comment"; +import createAnchor from "./create-anchor"; +import preWrapper from "./pre-wrapper"; +import previousNext from "./previous-next"; const plugins = [ vue({ @@ -26,15 +27,16 @@ const plugins = [ markdownItSetup(md) { md.use(snippet) .use(preWrapper) - .use(container, 'demo', demo) - .use(...createTable('table', '')) - .use(...createBlock('block', '')) - .use(...createTitle('title', '')) - .use(...createDescribe('describe', '')) - .use(...createComment('comment', '')) - .use(...createAnchor('anchor', '')) + .use(container, "demo", demo) + .use(...createTable("table", "")) + .use(...createBlock("block", "")) + .use(...createTitle("title", "")) + .use(...createDescribe("describe", "")) + .use(...createComment("comment", "")) + .use(...createAnchor("anchor", "")) + .use(...previousNext("previousNext", "")); }, }), -] as any +] as any; -export default plugins \ No newline at end of file +export default plugins; diff --git a/example/src/plugin/previous-next.ts b/example/src/plugin/previous-next.ts new file mode 100644 index 00000000..56990caa --- /dev/null +++ b/example/src/plugin/previous-next.ts @@ -0,0 +1,55 @@ +import container from "markdown-it-container"; +import type Token from "markdown-it/lib/token"; +import menus from "../view/utils/menus"; +type ContainerArgs = [ + typeof container, + string, + { + render(tokens: Token[], idx: number): string; + } +]; + +export default function createContainer( + klass: string, + defaultTitle: string +): ContainerArgs { + return [ + container, + klass, + { + render(tokens, idx) { + const token = tokens[idx]; + const info = token.info.trim().slice(klass.length).trim(); + const menusChild = menus.map((item) => item.children).flat(1); + let prevIndex = 0; + let nextIndex = 0; + menusChild.forEach((item, index) => { + if (item.subTitle === info) { + prevIndex = index - 1; + nextIndex = index + 1; + } + }); + if (token.nesting === 1) { + return `
+
${ + menusChild[prevIndex]?.title + }
+
${ + menusChild[nextIndex]?.title + }
+
`; + } else { + return ``; + } + }, + }, + ]; +} diff --git a/example/src/view/component.vue b/example/src/view/component.vue index 82b6f645..b7114706 100644 --- a/example/src/view/component.vue +++ b/example/src/view/component.vue @@ -52,6 +52,7 @@