Skip to content

Commit 8cf9e6a

Browse files
committed
Wiki markup: fixed emphasis + merged some url patterns + added TODOs
1 parent 5203dd1 commit 8cf9e6a

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

components/prism-wiki.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ Prism.languages.wiki = Prism.languages.extend('markup', {
1212
}
1313
},
1414
'emphasis': {
15-
pattern: /('{2,4}).+?\1/,
15+
// TODO Multi-line
16+
pattern: /('{2,5}).+?\1/,
1617
inside: {
1718
'bold italic': {
18-
pattern: /('''').+?(?=\1)/,
19+
pattern: /(''''').+?(?=\1)/,
1920
lookbehind: true
2021
},
2122
'bold': {
22-
pattern: /(''').+?(?=\1)/,
23+
pattern: /(''')[^'](?:.*?[^'])?(?=\1)/,
2324
lookbehind: true
2425
},
2526
'italic': {
26-
pattern: /('').+?(?=\1)/,
27+
pattern: /('')[^'](?:.*?[^'])?(?=\1)/,
2728
lookbehind: true
2829
},
2930
'punctuation': /^''+|''+$/
@@ -34,13 +35,13 @@ Prism.languages.wiki = Prism.languages.extend('markup', {
3435
alias: 'punctuation'
3536
},
3637
'url': [
37-
/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b/i,
38-
/(?:RFC|PMID) +\d+/,
39-
/\[\[.+?\]\]/,
40-
/\[.+?\]/
38+
/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:RFC|PMID) +\d+/i,
39+
/\[\[.+?\]\]|\[.+?\]/
4140
],
4241
'variable': [
4342
/__[A-Z]+__/,
43+
// FIXME Nested structures should be handled
44+
// {{formatnum:{{#expr:{{{3}}}}}}}
4445
/\{{3}.+?\}{3}/,
4546
/\{\{.+?}}/
4647
],

components/prism-wiki.min.js

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

examples/prism-wiki.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h2>Headings</h2>
1414
====== Header 6 ======</code></pre>
1515

1616
<h2>Bold and italic</h2>
17-
<pre><code>''''Both bold and italic''''
17+
<pre><code>'''''Both bold and italic'''''
1818
'''Only bold'''
1919
''Only italic''</code></pre>
2020

0 commit comments

Comments
 (0)