mirror of
https://github.com/arsenetar/PrismHighlight.git
synced 2024-11-23 20:39:01 +00:00
25 lines
806 B
JavaScript
25 lines
806 B
JavaScript
Prism.languages.bash = Prism.languages.extend('clike', {
|
|
'comment': {
|
|
pattern: /(^|[^"{\\])(#.*?(\r?\n|$))/g,
|
|
lookbehind: true
|
|
},
|
|
'string': {
|
|
//allow multiline string
|
|
pattern: /("|')(\\?[\s\S])*?\1/g,
|
|
inside: {
|
|
//'property' class reused for bash variables
|
|
'property': /\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/g
|
|
}
|
|
},
|
|
'keyword': /\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/g
|
|
});
|
|
|
|
Prism.languages.insertBefore('bash', 'keyword', {
|
|
//'property' class reused for bash variables
|
|
'property': /\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/g
|
|
});
|
|
Prism.languages.insertBefore('bash', 'comment', {
|
|
//shebang must be before comment, 'important' class from css reused
|
|
'important': /(^#!\s*\/bin\/bash)|(^#!\s*\/bin\/sh)/g
|
|
});
|