Coder Social home page Coder Social logo

Add option to display spaces about ansi-to-html HOT 5 OPEN

rburns avatar rburns commented on August 22, 2024 1
Add option to display spaces

from ansi-to-html.

Comments (5)

rburns avatar rburns commented on August 22, 2024 1

@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.

brettz9 avatar brettz9 commented on August 22, 2024

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.

rburns avatar rburns commented on August 22, 2024

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.

brettz9 avatar brettz9 commented on August 22, 2024

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.

brettz9 avatar brettz9 commented on August 22, 2024

Though of course whatever API you prefer--just demoing the idea...

from ansi-to-html.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.