File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
packages/@vuepress/markdown/lib Expand file tree Collapse file tree 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')
1313const hoistScriptStylePlugin = require ( './hoist' )
1414const convertRouterLinkPlugin = require ( './link' )
1515const containersPlugin = require ( './containers' )
16+ const contentSlotsContainersPlugin = require ( './contentSlotsContainers' )
1617const snippetPlugin = require ( './snippet' )
1718const emojiPlugin = require ( 'markdown-it-emoji' )
1819const anchorPlugin = require ( 'markdown-it-anchor' )
@@ -75,6 +76,10 @@ module.exports = ({
7576 . use ( containersPlugin )
7677 . end ( )
7778
79+ . plugin ( 'content-slots-containers' )
80+ . use ( contentSlotsContainersPlugin )
81+ . end ( )
82+
7883 . plugin ( 'emoji' )
7984 . use ( emojiPlugin )
8085 . end ( )
You can’t perform that action at this time.
0 commit comments