-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve single new-line gaps between elements #58
Conversation
Hi @rndmerle thank you for PR. I will check it. |
@@ -116,7 +116,8 @@ function collapsable(node) { | |||
/* Collapse to spaces, or newlines if they’re in a run. */ | |||
function collapseToNewLines(value) { | |||
var result = String(value).replace(/\s+/g, function($0) { | |||
return $0.indexOf('\n') === -1 ? ' ' : '\n' | |||
const newLinesCount = ($0.match(/\n/g) || []).length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comments why 2 newlines are added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a leftover from when I was exploring some solutions.
I'll check but it seems unneeded.
Thanks for the review, I'll check it out in detail a bit later ;) |
Code has been improved ;) |
Good job! 👍 |
@rndmerle new version was released and can be checked on the playground in ~5min. |
I tested it on some big forms. It works wonder 😎 It's a bit off-topic but I just noticed that the playground is not indenting the content of <script> and <style> elements while the prettyhtml client (0.5.0) does. |
@rndmerle this is a known limitation because prettyhtml wasn't built for the web (even not with browserify) the option |
@rndmerle would you like to join to the prettyhtml team? |
Thanks much for asking but I've few spare time to contribute here and there and I prefer not to feel entitled to a particular project, nor promise I can spend more time when I maybe won't. |
I was just looking for how to fix this issue as well. Thanks for fixing this @rndmerle |
Hi :)
I tried to get a stab at #43
I'm really not sure it's done the best it could be, but it sounds decent.
If you think of a better way, or at least better names, please tell me.
I didn't know if you wanted this feature behind an option. It's still possible.