Comments (5)
@the-duck having a toggle to preserve spaces seems reasonable. maybe outputting it as an html entity (` ') is a better option than a span element.
It's related to the existing configuration option for preserving newlines. (https://github.com/rburns/ansi-to-html/blob/master/README.md#options) It would be tempting to preserve spaces and newlines in one config key. Though, the newlines
key behaviour would need to be unchanged for compatibility.
Possibly the existing newlines
key and an additional spaces
key. or alternatively the existing newlines
key and an additional whitespace
key that does both. Not certain which would be most useful.
from ansi-to-html.
Or how about newlines
, spaces
, and a setting whitespace
that does both?
Just in case one wishes XML support,  
would be a little safer than
which may only be supported in HTML (HTML supports either).
Am eager to have an option to auto-generate CLI docs (using command-line-usage
), and preserving spacing is critical for this. But your tool otherwise looks to be doing the job quite nicely!
from ansi-to-html.
Either of those solutions are likely fine. (three config keys, or two). I struggle to imagine a scenario where you would want spaces preserved, but not newlines, or the opposite.
I guess a whitespace key would have to take into account not only spaces and newlines, but also other whitespace characters like tabs.
Makes me think newlines
and whitespace
would be enough. For example, adding a tabs
key in addition to newlines
and spaces
wouldn't make a lot of sense.
from ansi-to-html.
In my PR #57 , I've just added a tabs
option as well, as I do think it's utility as a separate preference can be in using it to indicate the number of non-breaking spaces that each tab should be converted into.
from ansi-to-html.
Though of course whatever API you prefer--just demoing the idea...
from ansi-to-html.
Related Issues (20)
- Infinite loop with specific ANSI string HOT 2
- Cyan color preventing `<b>` tag from getting closed correctly 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.