Skip to content

Commit 6f58672

Browse files
committed
fix(): remove region comment when importing snippets
permit nesting regions for partial code snippets import
1 parent 037aa14 commit 6f58672

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/@vuepress/markdown/lib/snippet.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function findRegion (lines, regionName) {
6262
}
6363
}
6464
} else if (testLine(line, regexp, regionName, true)) {
65-
return { start, end: lineId }
65+
return { start, end: lineId, regexp }
6666
}
6767
}
6868

@@ -90,7 +90,10 @@ module.exports = function snippet (md, options = {}) {
9090

9191
if (region) {
9292
content = dedent(
93-
lines.slice(region.start, region.end).join('\n')
93+
lines
94+
.slice(region.start, region.end)
95+
.filter(line => !region.regexp.test(line.trim()))
96+
.join('\n')
9497
)
9598
}
9699
}

0 commit comments

Comments
 (0)