-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Request] Basic ANSI/VT100 Control Sequence Colorization/Formatting Support #3160
Comments
Not sure I follow. Please provide an example of input/output. |
It may be non-trival to parse just because it's not symetrical like some grammars, but basically
to More context:
|
Sorry to crush your hopes, but this isn't what we do. We highlight code verbatim - we do not modify it or otherwise attempt to "render" it. If we supported ANSI (as a grammar) it would look just like the first capture but perhaps with the escape sequences highlighted so that they "popped", etc... This is a great idea though. Seems like the kind of thing that'd be pretty easy to do (at least for the FG/BG ANSI sequences - less so the move cursor, etc), but sounds like a separate library. |
Fair enough :). Thank you! |
I would love this for the convenience of being able to stick colorized terminal output into a code block and get it rendered as we would expect (by having something to interpret the escape sequences). It would be nice if highlightjs could do this, then it would work out of the box in something like reveal.js for presentations. Although it is true that ANSI escape sequences seems at first a completely different paradigm from what highlightjs does keeping content verbatim and applying styling... It seems possible if you just take the ansi escape sequences themselves, put those into spans, styled as
|
Anyone wishing to write truly unique parsing engines (for custom grammars) is now free to do so via #3620. Though the output must still be a valid HLJS token stream - ie all you can emit are named scopes and text, etc... https://highlightjs.readthedocs.io/en/latest/mode-reference.html#emittokens |
Is your request related to a specific problem you're having?
Less of a problem and more of a hope.
The solution you'd prefer / feature you'd like to see added...
In essence, basic support for formatting or stripping out ANSI/VT100 codes for
console/shell-session
. Not full on terminal replay support, but basic support for translating color and formatting codes into corresponding markup and CSS and removing unsupported codes.Additional context...
Basically to enable taking console output directly from colorized CLI output and embedding it in markdown. Evening more specifically, to enable colorized support for console output snippets in comments made by build tools without having to dive into terminal logs.
The text was updated successfully, but these errors were encountered: