Commit bde4ac4 1 parent 704031f commit bde4ac4 Copy full SHA for bde4ac4
File tree 2 files changed +17
-0
lines changed
packages/@vuepress/markdown/lib
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change
1
+ const container = require ( 'markdown-it-container' )
2
+
3
+ const SLOT_KEY = 'slot'
4
+
5
+ module . exports = md => {
6
+ md
7
+ . use ( container , SLOT_KEY , {
8
+ render : ( tokens , idx ) => tokens [ idx ] . nesting === 1
9
+ ? `<template slot="${ tokens [ idx ] . info . trim ( ) . slice ( SLOT_KEY . length ) . trim ( ) } ">`
10
+ : '</template>'
11
+ } )
12
+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const componentPlugin = require('./component')
13
13
const hoistScriptStylePlugin = require ( './hoist' )
14
14
const convertRouterLinkPlugin = require ( './link' )
15
15
const containersPlugin = require ( './containers' )
16
+ const contentSlotsContainersPlugin = require ( './contentSlotsContainers' )
16
17
const snippetPlugin = require ( './snippet' )
17
18
const emojiPlugin = require ( 'markdown-it-emoji' )
18
19
const anchorPlugin = require ( 'markdown-it-anchor' )
@@ -75,6 +76,10 @@ module.exports = ({
75
76
. use ( containersPlugin )
76
77
. end ( )
77
78
79
+ . plugin ( 'content-slots-containers' )
80
+ . use ( contentSlotsContainersPlugin )
81
+ . end ( )
82
+
78
83
. plugin ( 'emoji' )
79
84
. use ( emojiPlugin )
80
85
. end ( )
You can’t perform that action at this time.
0 commit comments