mirror of
https://github.com/Funkoala14/knowledgebase_law.git
synced 2025-06-09 07:38:15 +08:00
37 lines
883 B
JavaScript
37 lines
883 B
JavaScript
|
'use strict'
|
||
|
|
||
|
module.exports = bbcode
|
||
|
bbcode.displayName = 'bbcode'
|
||
|
bbcode.aliases = ['shortcode']
|
||
|
function bbcode(Prism) {
|
||
|
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'"\]=]+)/,
|
||
|
inside: {
|
||
|
punctuation: [
|
||
|
/^=/,
|
||
|
{
|
||
|
pattern: /^(\s*)["']|["']$/,
|
||
|
lookbehind: true
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
punctuation: /\]/,
|
||
|
'attr-name': /[^\s=\]]+/
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
Prism.languages.shortcode = Prism.languages.bbcode
|
||
|
}
|