-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
console: add support for %c style formatter in console.log() #29605
Comments
Technically possible but we'd need to bring in a CSS parser, map all the ANSI stuff, etc... What if we just strip out %c formatting entirely:
|
For now, I'd say stripping out the %c formatting is the better approach. |
Fixes: nodejs#29605 Refs: https://console.spec.whatwg.org Co-Authored-By: Anna Henningsen <github@addaleax.net>
Fixes: #29605 Refs: https://console.spec.whatwg.org PR-URL: #29606 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fixes: #29605 Refs: https://console.spec.whatwg.org PR-URL: #29606 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Is there any interest in pursuing this to make CSS I think that what would need to change is here: https://github.com/nodejs/node/blob/main/lib/internal/util/inspect.js#L2263 |
Node's console currently supports a number of formatters,
s, j, d, o, O, i, f
. However, it doesn't support%c
:The same code in Safari, Firefox, and Chrome does this:
The Console spec doesn't give a ton of help on what
%c
should do, other than to say that it "Applies provided CSS."Obviously there are aspects of this that don't make sense in the terminal vs. a browser, but perhaps some of it does? It would be nice if node's
console
could do more than ignore%c
.Apologies if this has come up in the past and been rejected. I wasn't able to find a previous discussion.
The text was updated successfully, but these errors were encountered: