Comments (3)
๐
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.
@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.
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
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 rehype-format.