docs: 优化文档
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0)"> 0.2.0 </a>
|
||||
<a href="javascript:void(0)"> 0.2.1 </a>
|
||||
</li>
|
||||
</ul>
|
||||
</lay-header>
|
||||
@@ -349,6 +349,7 @@ export default {
|
||||
position: fixed;
|
||||
margin-top: 60px;
|
||||
height: calc(100% - 60px);
|
||||
box-shadow: 2px 0 8px 0 rgb(29 35 41 / 5%);
|
||||
}
|
||||
|
||||
.layui-layout-document > .layui-layout > .layui-body {
|
||||
|
||||
@@ -4,7 +4,9 @@ import container from 'markdown-it-container'
|
||||
import highlight from './highlight'
|
||||
import snippet from './snippet'
|
||||
import demo from './demo'
|
||||
import createContainer from './create-container'
|
||||
import createTitle from './create-title'
|
||||
import createBlock from './create-block'
|
||||
import createDescribe from './create-describe'
|
||||
import preWrapper from './pre-wrapper'
|
||||
|
||||
const plugins = [
|
||||
@@ -22,7 +24,9 @@ const plugins = [
|
||||
md.use(snippet)
|
||||
.use(preWrapper)
|
||||
.use(container, 'demo', demo)
|
||||
.use(...createContainer('field', '描述信息'))
|
||||
.use(...createBlock('block', '描述信息'))
|
||||
.use(...createTitle('title', '标题信息'))
|
||||
.use(...createDescribe('describe', '描述信息'))
|
||||
},
|
||||
}),
|
||||
] as any
|
||||
|
||||
31
docs/src/plugin/create-block.ts
Normal file
31
docs/src/plugin/create-block.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import container from 'markdown-it-container'
|
||||
import type Token from 'markdown-it/lib/token'
|
||||
|
||||
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()
|
||||
if (token.nesting === 1) {
|
||||
return `<lay-block style="margin-left:8px;margin-bottom:40px;">${info}`
|
||||
} else {
|
||||
return '</lay-block>\n'
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
31
docs/src/plugin/create-describe.ts
Normal file
31
docs/src/plugin/create-describe.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import container from 'markdown-it-container'
|
||||
import type Token from 'markdown-it/lib/token'
|
||||
|
||||
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()
|
||||
if (token.nesting === 1) {
|
||||
return `<p>${info}`
|
||||
} else {
|
||||
return '</p>\n'
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -56,7 +56,7 @@ const zhCN = [
|
||||
},
|
||||
{
|
||||
path: '/zh-CN/components',
|
||||
redirect: '/zh-CN/components/button',
|
||||
redirect: '/zh-CN/components/color',
|
||||
component: Component,
|
||||
meta: { title: '组件' },
|
||||
children: [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<lay-layout>
|
||||
<lay-side>
|
||||
<lay-scroll>
|
||||
<lay-scroll style="overflow-y: scroll;">
|
||||
<ul class="layui-menu layui-menu-lg layui-menu-docs">
|
||||
<li
|
||||
v-for="menu in menus"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<lay-layout>
|
||||
<lay-side>
|
||||
<lay-scroll>
|
||||
<lay-scroll style="overflow-y: scroll;">
|
||||
<ul class="layui-menu layui-menu-lg layui-menu-docs">
|
||||
<li
|
||||
v-for="menu in menus"
|
||||
@@ -85,25 +85,7 @@ export default {
|
||||
title: '更新',
|
||||
subTitle: 'change log',
|
||||
path: '/zh-CN/guide/changelog',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
title: '规范',
|
||||
subTitle: 'norms',
|
||||
path: '/zh-CN/guide/norms',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: '问题',
|
||||
subTitle: 'problem',
|
||||
path: '/zh-CN/guide/problem',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: '贡献',
|
||||
subTitle: 'contribution',
|
||||
path: '/zh-CN/guide/contribution',
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<lay-layout>
|
||||
<lay-side>
|
||||
<lay-scroll>
|
||||
<lay-scroll style="overflow-y: scroll;">
|
||||
<ul class="layui-menu layui-menu-lg layui-menu-docs">
|
||||
<li
|
||||
v-for="menu in menus"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
>
|
||||
</div>
|
||||
<div class="site-version">
|
||||
<span>当前版本:v<cite class="site-showv">0.2.0</cite></span>
|
||||
<span>当前版本:v<cite class="site-showv">0.2.1</cite></span>
|
||||
<span
|
||||
><router-link
|
||||
class="layui-inline site-down"
|
||||
|
||||
Reference in New Issue
Block a user