Skip to content

Commit 8f2a60e

Browse files
committed
revert to forloop instead
1 parent 967cda7 commit 8f2a60e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: packages/@vuepress/markdown/lib/snippet.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = function snippet (md, options = {}) {
44
const root = options.root || process.cwd()
55

66
function parser (state, startLine, endLine, silent) {
7+
const CH = '<'.charCodeAt(0)
78
const pos = state.bMarks[startLine] + state.tShift[startLine]
89
const max = state.eMarks[startLine]
910

@@ -13,8 +14,9 @@ module.exports = function snippet (md, options = {}) {
1314
return false
1415
}
1516

16-
if (!/^<<</.test(state.src)) {
17-
return false
17+
for (let i = 0; i < 3; ++i) {
18+
const ch = state.src.charCodeAt(pos + i)
19+
if (ch !== CH || pos + i >= max) return false
1820
}
1921

2022
if (silent) {

0 commit comments

Comments
 (0)