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
Fix support for nested styles #335
Conversation
Unfortunately this doesn't solve it. This is intentional. The history of escape codes is annoying and unclear, but Also, "dim" is usually the analog of "bold", so having both modes enabled at once wouldn't make much sense under such an interpretation, hence most implementations keeping it simply I wish it was this easy. |
Thank you @Qix- for information. I didn't know much about escape code, I've checked '\u001b[1mfoo \u001b[31m\u001b[2mbar\u001b[22m\u001b[1m\u001b[39m baz\u001b[22m' ansi-colors
'\u001b[1mfoo \u001b[31m\u001b[2mbar \u001b[1m\u001b[39m baz\u001b[22m' chalk As you can see the only difference between Also, all test passed except the one that compares the nesting style result. |
This is how |
Yeah, this seems right. @sindresorhus at some point we need to condense codes down into a single CSI character and not repeat it because that output is ugly (not your problem @farnabaz). |
@mirefly Can you fix the merge conflict? |
Can you also try to write a more descriptive PR title of what this fixes? |
@sindresorhus I guess you mean the author @farnabaz ? |
Yes, sorry. |
@sindresorhus Done |
As I recovered both
bold
anddim
style has same closing chars and this cause the problemOn line 165 all closing chars on current style replace by opening chars, so in this specific situation closing tag of
dim
replaced bybold
opening tag andbar
seen asdim
chalk/index.js
Line 165 in 7b9211b
Fixes #334