-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for the BBCode markup language.
- Loading branch information
1 parent
ee7fdbe
commit aaf13aa
Showing
8 changed files
with
293 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Prism.languages.bbcode = { | ||
'tag': { | ||
pattern: /\[\/?[^\s=\]]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))?(?:\s+[^\s=\]]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))*\s*\]/, | ||
inside: { | ||
'tag': { | ||
pattern: /^\[\/?[^\s=\]]+/, | ||
inside: { | ||
'punctuation': /^\[\/?/ | ||
} | ||
}, | ||
'attr-value': { | ||
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+)/i, | ||
inside: { | ||
'punctuation': [ | ||
/^=/, | ||
{ | ||
pattern: /^(\s*)["']|["']$/, | ||
lookbehind: true | ||
} | ||
] | ||
} | ||
}, | ||
'punctuation': /\]/, | ||
'attr-name': /[^\s=\]]+/ | ||
} | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h2>Full example</h2> | ||
<pre><code>[list] | ||
[*]Entry A | ||
[*]Entry B | ||
[/list] | ||
|
||
[list=1] | ||
[*]Entry 1 | ||
[*]Entry 2 | ||
[/list] | ||
|
||
[style color="fuchsia"]Text in fuchsia[/style] or | ||
[style color=#FF00FF]Text in fuchsia[/style] or | ||
[color=#FF00FF]Text in fuchsia[/color] | ||
[quote]quoted text[/quote] | ||
[quote="author"]quoted text[/quote] | ||
|
||
[:-)] | ||
|
||
[url]https://en.wikipedia.org[/url] | ||
[url=https://en.wikipedia.org]English Wikipedia[/url]</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
[list] | ||
[*]Entry A | ||
[*]Entry B | ||
[/list] | ||
|
||
[list=1] | ||
[*]Entry 1 | ||
[*]Entry 2 | ||
[/list] | ||
|
||
[style color="fuchsia"]Text in fuchsia[/style] or | ||
[style color=#FF00FF]Text in fuchsia[/style] or | ||
[color=#FF00FF]Text in fuchsia[/color] | ||
[quote]quoted text[/quote] | ||
[quote="author"]quoted text[/quote] | ||
|
||
[:-)] | ||
|
||
[url]https://en.wikipedia.org[/url] | ||
[url=https://en.wikipedia.org]English Wikipedia[/url] | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"list" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"*" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"Entry A\n ", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"*" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"Entry B\n", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"list" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
|
||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"list" | ||
]], | ||
["attr-value", [ | ||
["punctuation", "="], | ||
"1" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"*" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"Entry 1\n ", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"*" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"Entry 2\n", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"list" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
|
||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"style" | ||
]], | ||
["attr-name", "color"], | ||
["attr-value", [ | ||
["punctuation", "="], | ||
["punctuation", "\""], | ||
"fuchsia", | ||
["punctuation", "\""] | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"Text in fuchsia", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"style" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
" or\n", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"style" | ||
]], | ||
["attr-name", "color"], | ||
["attr-value", [ | ||
["punctuation", "="], | ||
"#FF00FF" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"Text in fuchsia", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"style" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
" or\n", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"color" | ||
]], | ||
["attr-value", [ | ||
["punctuation", "="], | ||
"#FF00FF" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"Text in fuchsia", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"color" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"quote" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"quoted text", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"quote" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"quote" | ||
]], | ||
["attr-value", [ | ||
["punctuation", "="], | ||
["punctuation", "\""], | ||
"author", | ||
["punctuation", "\""] | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"quoted text", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"quote" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
|
||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
":-)" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
|
||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"url" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"https://en.wikipedia.org", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"url" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "["], | ||
"url" | ||
]], | ||
["attr-value", [ | ||
["punctuation", "="], | ||
"https://en.wikipedia.org" | ||
]], | ||
["punctuation", "]"] | ||
]], | ||
"English Wikipedia", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "[/"], | ||
"url" | ||
]], | ||
["punctuation", "]"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for tags. |