Open esoreq opened 4 years ago
Have you tried the different themes with chroma --json
?
So I think this is a problem in how you parse specific tags internally - vim was just used as an example here is dracula
I'm honestly not sure what the actual complaint is? If you're saying some themes highlight different things, that's correct. It depends on if the theme has assignments for those classes of tokens.
If you're referring to eg. "mkdir" and "cp" not being highlighted, that's because they are not counted as builtins. See this line for details.
That is exactly what I was referring to - is there a workaround - i.e. explicitly adding them ?
@alecthomas
For reference, you can look into Rogue used in Jekyll.
Implementation of Rogue: https://github.com/rouge-ruby/rouge/blob/442c8f430277889afc6ce0ccbbdbdaec687abc0f/lib/rouge/lexers/shell.rb
Ref: Screenshot
@alecthomas
- In addition to "mkdir" and "cp", we could also highlight commands like "sudo" & "ls".
- We could also highlight configuration variables(the one that start with --) in different colour. Example: "dotnet --version".
It could be interesting, for bash
, to separate :
$ k=$(compgen -k); echo $k
if then else elif fi case esac for select while until do done in function time { } ! [[ ]] coproc
$ b=$(compgen -b); echo $b
. : [ alias bg bind break builtin caller cd command compgen complete compopt continue declare dirs disown echo enable eval exec exit export false fc fg getopts hash help history jobs kill let local logout mapfile popd printf pushd pwd read readarray readonly return set shift shopt source suspend test times trap true type typeset ulimit umask unalias unset wait
Maybe builtins and keywords could be considered as the same "thing", for highlighting purpose.
|
, in $(command)
constructions, etc..., when not understood as known cases (assignation, builtin, keyword, case
patterns, continuation lines, etc...). It is impossible to have a full list of commands, as it is done in Rogue example, by definition.-
or --
)Hi everyone, i'm bumping this thread in the hope of a future modification!
Hi I get weird results for specific commands in bash rendering
For example the following code when rendered using (https://swapoff.org/chroma/playground/) vim style will identify some commands but not all.