Skip to content

Commit

Permalink
Fix matchInContainer false positives
Browse files Browse the repository at this point in the history
The function should match only the beginnings of lines.

For example, see this testcase:
```
:::spoiler
here is a :::
:::
:::
```
The last line should be completed.

Without this patch, the third line is completed and the last is not.

Signed-off-by: Tamotsu Takahashi <ttakah@gmail.com>
  • Loading branch information
tamo authored and Tamotsu Takahashi committed Sep 25, 2020
1 parent cebd5e7 commit ac43db8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3137,7 +3137,7 @@ function checkInContainerSyntax () {

function matchInContainer (text) {
var match
match = text.match(/:{3,}/g)
match = text.match(/(^|\n):::/gm)
if (match && match.length % 2) {
return true
} else {
Expand Down

0 comments on commit ac43db8

Please sign in to comment.