Comments (5)
Just after opening this issue, I realized that flipping the order in which color styles are applied to the header texts fixes the issue. It appears that doing cyan before bold is causing the problem here. Not sure if there still is a bug in ansi-to-html
, though.
from ansi-to-html.
It appears to me that the 22 escaped code may be ignored as the previous opening bold tag is not on the top of the stack. https://github.com/rburns/ansi-to-html/blob/master/src/ansi_to_html.js#L149 https://github.com/rburns/ansi-to-html/blob/master/src/ansi_to_html.js#L299
the trailing close bold tag is on account of closing the remaining tags in the stack.
I've been trying to come up with a small test case which demonstrates that's what's happening. no luck yet.
In general, interpreting 22 as <span style="font-weight: normal">
instead of </b>
might be a better approach.
from ansi-to-html.
this looks about right.
with the current release
convert.toHtml('\x1b[1m\x1b[36mname\x1b[22m|')
will produce
<b><span style="color:#0AA">name|</span></b>
which leaves the '|' erroneously bold.
Can you test the code on this branch, and see if it gives better results: https://github.com/rburns/ansi-to-html/pull/50/files
from ansi-to-html.
Thanks @rburns.
Those changes appear to work as well.
With this, I wonder if it would make sense to change the starting <b>
to a span element with a bold style.
from ansi-to-html.
for consistencies sake, it would probably make sense to use a style attribute instead of a bold tag. But, in the interest of not changing something that works, I'd probably lean towards leaving it as it is.
The relevance of the using the style attribute for 'normal' text is that there isn't a <normal>
tag, in the way that there is a <bold>
tag. The previous solution used a </bold>
tag to emulate <normal>
, which is context sensitive, and led to the bug.
Similarly, these https://github.com/rburns/ansi-to-html/blob/master/src/ansi_to_html.js#L150-L151 might better be implemented with font-style
and text-decoration
css properties.
But, this appears to fix this issue, so I'll merge it before making more changes.
from ansi-to-html.
Related Issues (20)
- Infinite loop with specific ANSI string HOT 2
- Add option to display spaces HOT 5
- Types HOT 7
- underline stickiness HOT 7
- Factor out generic parser and add ANSI-to-browser-console-log HOT 1
- inverse color is ignored HOT 3
- Multi `\r` makes following message disappear HOT 3
- Performance issue because of lots of nested layers HOT 4
- No support to convert \t? HOT 2
- Support for `Reset all attributes` sequence HOT 5
- Failure on \r sequences HOT 11
- Ship ES6 module HOT 3
- Output is broken when input stream gets chunked in the middle of an escape sequence
- Add support for PTY pseudo terminal HOT 1
- RangeError: Maximum call stack size exceeded HOT 1
- [Question] HTML to Text output HOT 3
- CVE-2021-23424L : ansi-html (0.0.7) Security Vulnerability issue HOT 2
- HOW_TO for Dummies
- Suggestion: Have CSS classes instead of styles
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansi-to-html.