Skip to content

Commit 396da81

Browse files
committed
feat($theme-default): markdown details custom block (close vuejs#768)
1 parent 50196a3 commit 396da81

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

packages/@vuepress/theme-default/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ module.exports = (options, ctx) => {
4848
'/zh/': '警告'
4949
}
5050
}],
51+
['container', {
52+
type: 'details',
53+
before: info => `<details class="custom-block details">${info ? `<summary>${info}</summary>` : ''}\n`,
54+
after: () => '</details>\n'
55+
}],
5156
['smooth-scroll', enableSmoothScroll]
5257
]
5358
}

packages/@vuepress/theme-default/styles/custom-blocks.styl

+16-2
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,19 @@
2626
color darken(red, 40%)
2727
a
2828
color $textColor
29-
30-
29+
&.details
30+
display block
31+
position relative
32+
border-radius 2px
33+
margin 1.6em 0
34+
padding 1.6em
35+
background-color #eee
36+
h4
37+
margin-top 0
38+
figure, p
39+
&:last-child
40+
margin-bottom 0
41+
padding-bottom 0
42+
summary
43+
outline none
44+
cursor pointer

0 commit comments

Comments
 (0)