Keeps line and indentation on remove()
See original GitHub issueWhen I remove an indented element that makes up the whole line it preserves the line and the indentation. This makes a document with many remove() look dirty, since it’s filled with indented whitespace on empty lines.
<span>lorem ipsum</span>
It should IMO remove the line if all the contents is gone.
Issue Analytics
- State:
- Created 11 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Remove or clear a hanging indent - Microsoft Support
Select the text where you want to remove a hanging indent. Go to Home > Paragraph dialog launcher Button image > Indents and...
Read more >Remove unecessary indents while keeping the relative ...
I a nutshell, I need to keep the minimal indentation level without loosing the relative indentations of the lines. So just drop the...
Read more >XSLT output formatting: keep line breaks, remove indent
When I set output indent to "yes", I get both, line-breaks and indents. When I set output indent to "no", I get none....
Read more >How to remove indentation on newline - CodeMirror
Bind Enter to a command like cm => cm.replaceSelection("\n") rather than the default, the newlineAndIndent command. 2 Likes.
Read more >Q. How to remove first line indent? - Ask COM Library
In order to remove the first line indentation, select the "Home" menu on the ribbon. Then select the arrow for the Paragraph settings....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not saying it would be hard to add to Yeoman, obviously it’s not, just would be a nice convenience in Cheerio, not having to evaluate the options, add as dep, import it, look up the API and the finally beautify, but whatever.
This is a div element with three children. A textnode containing a newline and 4 spaces, a div element with an id of “test”, and a textnode containing a newline. Removing the div child element does not (and should not) remove the text nodes.
I do understand what you want, you want the HTML resulting from Cheerio to be reformatted accoring to your preferred style. However this is not (currently) a functional goal of Cheerio, and is functionality that can best be achieved by processing the output of Cheerio with another function. I would recommend the mature and stable js-beautify) for HTML post-processing. It provides a number of options to format HTML to your standards