Skip to content

Commit d524a1b

Browse files
author
reco_luan
authored
Merge pull request #271 from franklinqin0/develop
set defaultTitle always to empty string & make tip, warning, danger vertically centered
2 parents 558c628 + ad64d75 commit d524a1b

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

packages/vuepress-theme-reco/index.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,21 @@ module.exports = (options, ctx) => ({
5757
'vuepress-plugin-smooth-scroll',
5858
['container', {
5959
type: 'tip',
60-
defaultTitle: {
61-
'/': '',
62-
'/zh/': '提示'
63-
}
60+
before: info => `<div class="custom-block tip"><p class="title">${info}</p>`,
61+
after: '</div>',
62+
defaultTitle: ''
6463
}],
6564
['container', {
6665
type: 'warning',
67-
defaultTitle: {
68-
'/': '',
69-
'/zh/': '注意'
70-
}
66+
before: info => `<div class="custom-block warning"><p class="title">${info}</p>`,
67+
after: '</div>',
68+
defaultTitle: ''
7169
}],
7270
['container', {
7371
type: 'danger',
74-
defaultTitle: {
75-
'/': '',
76-
'/zh/': '警告'
77-
}
72+
before: info => `<div class="custom-block danger"><p class="title">${info}</p>`,
73+
after: '</div>',
74+
defaultTitle: ''
7875
}],
7976
['container', {
8077
type: 'right',
@@ -83,7 +80,8 @@ module.exports = (options, ctx) => ({
8380
['container', {
8481
type: 'theorem',
8582
before: info => `<div class="custom-block theorem"><p class="title">${info}</p>`,
86-
after: '</div>'
83+
after: '</div>',
84+
defaultTitle: ''
8785
}],
8886
['container', {
8987
type: 'details',

packages/vuepress-theme-reco/styles/custom-blocks.styl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
&.tip
1111
background-color var(--code-color)
1212
border-color #67cc86
13-
.custom-block-title
13+
.title
1414
color #67cc86
1515
&.warning
1616
background-color var(--code-color)
1717
border-color #fb9b5f
18-
.custom-block-title
18+
.title
1919
color #fb9b5f
2020
&.danger
2121
background-color var(--code-color)
2222
border-color #f26d6d
23-
.custom-block-title
23+
.title
2424
color #f26d6d
2525
&.right
2626
color transparentify($textColor, 0.4)

0 commit comments

Comments
 (0)