Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f2a60e

Browse filesBrowse files
committed
revert to forloop instead
1 parent 967cda7 commit 8f2a60e
Copy full SHA for 8f2a60e

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed

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

Copy file name to clipboardExpand all lines: packages/@vuepress/markdown/lib/snippet.js
+4-2Lines changed: 4 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.