-
-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add console lexer #137
Comments
Sounds good. This should be relatively straightforward, though may require a tiny bit of refactoring. I'd happily accept PRs. |
Any schedule? |
Switch between "colorful" and "dracula" theme for light and dark mode, respectively. Adds a scss file with theme definitions. HTML code is generated with classes matching the scss theme. Deviation of default themes by setting the default background with a small difference in lightness to site background. Adds new scss variable `$black` which is the default background. Requires the update of Hugo in order to guess the syntax which helps to get code highlight for fenced code with the keyword `console` as this language is not recognized by Chroma, the lexer used by Hugo. Using `guessSyntax = true` results in some basic highlighting. Feature request for console lexer is open alecthomas/chroma#137 Fixes lowRISC#867 Fixes lowRISC#2262 Signed-off-by: Tobias Wölfel <tobias.woelfel@mailbox.org>
Switch between "colorful" and "dracula" theme for light and dark mode, respectively. Adds a scss file with theme definitions. HTML code is generated with classes matching the scss theme. Deviation of default themes by setting the default background with a small difference in lightness to site background. Adds new scss variable `$black` which is the default background. Requires the update of Hugo in order to guess the syntax which helps to get code highlight for fenced code with the keyword `console` as this language is not recognized by Chroma, the lexer used by Hugo. Using `guessSyntax = true` results in some basic highlighting. Feature request for console lexer is open alecthomas/chroma#137 Fixes #867 Fixes #2262 Signed-off-by: Tobias Wölfel <tobias.woelfel@mailbox.org>
Also |
@clinta, @alecthomas et al.: #551 offers a basic bash-session lexer, possibly good enough to consider this issue closed? |
Looks good to me. |
@chalin though it's a start, it appears that this simple lexer requires the
Another use case that comes to mind is anything related to git, where showing the current branch in the prompt would be very useful for examples/tutorial material. Edit: another aspect that isn't covered at all by the current lexer is multi-line commands:
|
I'm also wondering if there is a better way to differentiate between the root prompt and a comment? For now I have settled to appending a $ # regular user
$ sudo su
$ # superuser
# exit |
@nikhilweee From #551, the prompt regex is I tried the |
It looks like the shell session lexers are a bit more difficult than using pygments2chroma, but these lexers are very nice for writing tutorials with example shell commands, especially BashSessionLexer.
Example of the difference:
console
bash
$ sudo su # echo "foo" foo
The text was updated successfully, but these errors were encountered: