Currently, when using highlight.js to highlight a bash script, and you use the $ or # signs to present a command prompt, it is possible to select those characters. It would be great if one could disable them (which is not hard by using some CSS).
Anyway, for this it would be extremely helpful if those two characters would be given a special CSS class, if they are on the beginning of the line. I have seen in the definition for BASIC that is pretty simple, so basically all one needs to do is to add the appropriate regular expression to the bash definition:
{
// Match command prompt
className: 'symbol',
begin: '^\$ |#\ ',
relevance: 10
},
I would like to send a PR for that, but I am unsure about a few things:
command-prompt) or are they defined somewhere?Okay, I have found the list of class names by myself, but this now brings up the question which class to use?
Okay, we solved it differently: When you use shell, everything works as expected.
So, we use bash for actual scripts, and shell for the terminal, and we are fine with this.
The language names/codes supported by highlight.js are now here: https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md
Most helpful comment
Okay, we solved it differently: When you use
shell, everything works as expected.So, we use
bashfor actual scripts, andshellfor the terminal, and we are fine with this.