Skip to content

Commit c4cbeea

Browse files
AsciiDoc: Some regexes are too greedy (#3481)
1 parent 5665930 commit c4cbeea

File tree

3 files changed

+1073
-5
lines changed

3 files changed

+1073
-5
lines changed

components/prism-asciidoc.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
var asciidoc = Prism.languages.asciidoc = {
3030
'comment-block': {
31-
pattern: /^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,
31+
pattern: /^(\/{4,})$[\s\S]*?^\1/m,
3232
alias: 'comment'
3333
},
3434
'table': {
@@ -47,23 +47,23 @@
4747
},
4848

4949
'passthrough-block': {
50-
pattern: /^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
50+
pattern: /^(\+{4,})$[\s\S]*?^\1$/m,
5151
inside: {
5252
'punctuation': /^\++|\++$/
5353
// See rest below
5454
}
5555
},
5656
// Literal blocks and listing blocks
5757
'literal-block': {
58-
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
58+
pattern: /^(-{4,}|\.{4,})$[\s\S]*?^\1$/m,
5959
inside: {
6060
'punctuation': /^(?:-+|\.+)|(?:-+|\.+)$/
6161
// See rest below
6262
}
6363
},
6464
// Sidebar blocks, quote blocks, example blocks and open blocks
6565
'other-block': {
66-
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
66+
pattern: /^(--|\*{4,}|_{4,}|={4,})$[\s\S]*?^\1$/m,
6767
inside: {
6868
'punctuation': /^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/
6969
// See rest below

components/prism-asciidoc.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)