Can I add color to console prompt in highlight bash, to distinguish root and user?

Hi, all,

I would like to add color to console prompt in highlight bash, to distinguish root and user.
like:

{{<highlight bash }}
root #   <------------ *red color*
user $  <-----------   *green color*
{{< /highlight >}}

Any advice ?
Thanks.

I do not understand.
What is the relation between generating a web site (HTML/CSS) with Hugo and your console ??

And in any case, I guess this is a “bash” question. Not a Hugo one.

And in any case, I guess this is a “bash” question. Not a Hugo one.

I was writing a similar message like yours :wink: Then I looked again at the code and didn’t. I think they want to color the keywords inside of a highlight block on parsing by hugo into a (probably) code sample website. I don’t know if highlighting can be configured with RegExpes but that would be the way to go for this.

Roll your own. I don’t know of any highlighter covering current-user syntax.

Practically, I don’t think many people have code examples that switch users.

Thanks you all. I also looked at the code, it seems there is no solution by now.
Unless patch to https://github.com/alecthomas/chroma . Or a better way in put the prompt in line number position. @davidsneighbour , anyway it s not a key feature.

Something relevant . https://github.com/alecthomas/chroma/issues/137

1 Like