Skip to content

Commit ec9a76b

Browse files
author
weilei
committed
fix(docs): 统一文档中的代码示例格式
1 parent 25bba29 commit ec9a76b

22 files changed

+995
-935
lines changed

docs/components/typewriter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
## 使用示例
5656

57-
```html
57+
```vue
5858
<template>
5959
<div>
6060
<el-x-typewriter

docs/src/.vuepress/config.js

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = {
6464
],
6565
},
6666
],
67-
67+
6868
"/roadmap/": [
6969
{
7070
title: "🎀 开发计划",
@@ -105,14 +105,9 @@ module.exports = {
105105
},
106106
},
107107
markdown: {
108-
extendMarkdown: md => {
109-
// md.set({ highlight: false }) // 禁用默认高亮
110-
}
108+
111109
},
112-
// markdown: {
113-
// lineNumbers: true,
114-
// extractHeaders: ["h2", "h3", "h4", "h5", "h6"],
115-
// },
110+
116111
plugins: {
117112
"demo-container": {
118113
component: "demo-block",
@@ -123,36 +118,5 @@ module.exports = {
123118
headerAnchorSelector: ".header-anchor",
124119
},
125120
},
126-
// plugins: ['demo-container','@vuepress/active-header-links', {
127-
// sidebarLinkSelector: '.sidebar-link',
128-
// headerAnchorSelector: '.header-anchor'
129-
// }],
130-
// plugins: [
131-
// [
132-
// 'demo-container',
133-
// {
134-
// component: 'demo-block',
135-
// componentName: 'demo-block',
136-
// className: 'ElementUI-X-demo',
137121

138-
// locales: {
139-
// '/': {
140-
// 'demo-block': {
141-
// 'hide-text': '隐藏代码',
142-
// 'show-text': '显示代码',
143-
// 'copy-text': '复制代码',
144-
// 'copy-success': '复制成功'
145-
// }
146-
// }
147-
// }
148-
// }
149-
// ],
150-
// [
151-
// '@vuepress/active-header-links',
152-
// {
153-
// sidebarLinkSelector: '.sidebar-link',
154-
// headerAnchorSelector: '.header-anchor',
155-
// }
156-
// ]
157-
// ]
158122
};

docs/src/.vuepress/styles/index.styl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,24 @@ $accentColor = #409EFF
8585
}
8686

8787
// Element UI 文档风格的代码块样式
88+
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string {
89+
background:none;
90+
}
91+
div[class*=language-] pre,div[class*=language-] pre[class*=language-] code{
92+
font-size:12px;
93+
color:#000;
94+
}
95+
div[class*="language-"]::before {
96+
color:$accentColor;
97+
}
98+
99+
.demo-block .meta {
100+
background:none !important;
101+
}
102+
.demo-block .demo-block-control .copy-action-success {
103+
color: #67c23a !important;
104+
}
105+
88106

89107

90108
div,dl,dt,dd,ul,ol,li,tr,td,th,
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
// 颜色
22
$accentColor = #409EFF // 主题色,与 Element UI 默认主题色一致
3-
$textColor = #2c3e50 // 文本颜色
4-
$borderColor = #eaecef // 边框颜色
5-
$codeBgColor = #282c34 // 代码块背景色
6-
$arrowBgColor = #ccc // 箭头背景色
7-
$badgeTipColor = #42b983 // 提示徽标背景色
8-
$badgeWarningColor = #e7c000 // 警告徽标背景色
9-
$badgeErrorColor = #DA5961 // 错误徽标背景色
10-
3+
$codeBgColor = #fafafa
4+
$textColor = #333
115
// 布局
126
$navbarHeight = 3.6rem
137
$sidebarWidth = 20rem
@@ -18,3 +12,4 @@ $homePageWidth = 960px
1812
$MQNarrow = 959px
1913
$MQMobile = 719px
2014
$MQMobileNarrow = 419px
15+
@import '~prismjs/themes/prism.css'

docs/src/components/attachments.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@
1818
## 方法
1919

2020
| 方法名 | 说明 | 参数 | 返回值 |
21-
|--------|------|------|--------|
21+
| ------ | ---- | ---- | ------ |
2222
| | | | |
2323

2424
## 事件
2525

2626
| 事件名 | 说明 | 回调参数 |
27-
|--------|------|----------|
27+
| ------ | ---- | -------- |
2828
| | | |
2929

3030
## 使用示例
3131

3232
:::demo
33-
```html
33+
34+
```vue
3435
<template>
3536
<div>
3637
<!-- 示例代码 -->
@@ -42,12 +43,13 @@ export default {
4243
data() {
4344
return {
4445
// 数据
45-
}
46+
};
4647
},
4748
methods: {
4849
// 方法
49-
}
50-
}
50+
},
51+
};
5152
</script>
5253
```
54+
5355
:::

0 commit comments

Comments
 (0)