Git Product home page Git Product logo

Comments (3)

wooorm avatar wooorm commented on May 29, 2024

๐Ÿ‘

How this works is to first remove all whitespace, and then to add some back.
I donโ€™t think thereโ€™s any real special care for of comments, but for a solution I think just handling them the same as elements would work.

Can you create a PR?

from rehype-format.

rtm avatar rtm commented on May 29, 2024

@wooorm Thanks for replying. I took a look at the code, made some obvious changes, and found myself down a rabbit hole. I'm not convinced that this is a productive direction. I switched over to using a different HTML beautifier. I also need some convincing that the current logic preserves the exact semantics of the input, in cases such as <span>foo</span><span>bar</span>, where the non-existence of white space between the two spans has particular semantics which would be broken by moving them onto separate lines. I also am not convinced that the whole approach of starting off by squashing is the right way to go; among other reasons, it prevents any logic based on some level of preservation of original formatting, which is desirable in some cases, and provided by other HTML formatters.

from rehype-format.

wooorm avatar wooorm commented on May 29, 2024

Well, that was a long time!

fwiw, most of the bugs with the previous approach had to do with rehypejs/rehype-minify#19, which you alluded to as well with โ€œI also am not convinced that the whole approach of starting off by squashing is the right way to goโ€.

Stay safe!

from rehype-format.

Related Issues (6)

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.