Skip to content

Commit 68b95dc

Browse files
committed
fix(core): auto-generate close tag when custom open specified
1 parent 3d60211 commit 68b95dc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/core/src/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,18 @@ async function markdownMagic(globOrOpts = {}, options = {}) {
176176
open = `${opts.matchWord}:start`
177177
}
178178

179-
let close = CLOSE_WORD
180-
if (opts.close) {
179+
// When open is custom and close not specified, leave close undefined
180+
// to enable pattern mode in block-parser (auto-generates close as /OpenTag)
181+
let close
182+
if (opts.close !== undefined) {
181183
close = opts.close
182184
// @ts-ignore legacy
183185
} else if (opts.matchWord) {
184186
// @ts-ignore legacy
185187
close = `${opts.matchWord}:end`
188+
} else if (!opts.open || opts.open === OPEN_WORD) {
189+
// Only default to /docs when using default open word
190+
close = CLOSE_WORD
186191
}
187192

188193
const cwd = opts.cwd || process.cwd()

0 commit comments

Comments
 (0)