Skip to content

Commit

Permalink
Wiki markup: fixed emphasis + merged some url patterns + added TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Sep 3, 2015
1 parent 5203dd1 commit 8cf9e6a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions components/prism-wiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ Prism.languages.wiki = Prism.languages.extend('markup', {
}
},
'emphasis': {
pattern: /('{2,4}).+?\1/,
// TODO Multi-line
pattern: /('{2,5}).+?\1/,
inside: {
'bold italic': {
pattern: /('''').+?(?=\1)/,
pattern: /(''''').+?(?=\1)/,
lookbehind: true
},
'bold': {
pattern: /(''').+?(?=\1)/,
pattern: /(''')[^'](?:.*?[^'])?(?=\1)/,
lookbehind: true
},
'italic': {
pattern: /('').+?(?=\1)/,
pattern: /('')[^'](?:.*?[^'])?(?=\1)/,
lookbehind: true
},
'punctuation': /^''+|''+$/
Expand All @@ -34,13 +35,13 @@ Prism.languages.wiki = Prism.languages.extend('markup', {
alias: 'punctuation'
},
'url': [
/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b/i,
/(?:RFC|PMID) +\d+/,
/\[\[.+?\]\]/,
/\[.+?\]/
/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:RFC|PMID) +\d+/i,
/\[\[.+?\]\]|\[.+?\]/
],
'variable': [
/__[A-Z]+__/,
// FIXME Nested structures should be handled
// {{formatnum:{{#expr:{{{3}}}}}}}
/\{{3}.+?\}{3}/,
/\{\{.+?}}/
],
Expand Down
2 changes: 1 addition & 1 deletion components/prism-wiki.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/prism-wiki.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2>Headings</h2>
====== Header 6 ======</code></pre>

<h2>Bold and italic</h2>
<pre><code>''''Both bold and italic''''
<pre><code>'''''Both bold and italic'''''
'''Only bold'''
''Only italic''</code></pre>

Expand Down

0 comments on commit 8cf9e6a

Please sign in to comment.