Drop space before slash in empty elements
See original GitHub issueCurrently, the plug-in enforces a space before the closing slash in empty elements when xmlSelfClosingTags
is true
, normalizing <foo></foo>
and <foo/>
to <foo />
.
Some projects prefer the tighter <foo/>
syntax, so if an option already exists to configure empty tag handling, perhaps a third value could be added to support this convention, like:
true
(no space) –<foo/>
false
–<foo></foo>
space
(current behavior) –<foo />
If so, this setting could also be applied to the XML declaration, to permit
<?xml version="1.0" encoding="UTF-8"?>
instead of rewriting to insert an extra space before the closing ?>
as noted in #3:
<?xml version="1.0" encoding="UTF-8" ?>
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Space Before Closing Slash? - html - Stack Overflow
The answer is people wish to adhere to Appendix C of the XHTML1.0 specification. Which you only need to do if you are...
Read more >Avoid space before slash of self closing Xml element - MSDN
I have requirement to not to generate space that appears before slash of self closing element. Following code reads a xml file and...
Read more >Should I write "module/theme" or "module / theme"?
There are usually no spaces either before or after a slash. Exceptions are in representing the start of a new line when quoting...
Read more >How to remove space that appears before slash of self closing ...
I have a requirement not to generate have requirement to not to generate space that appears before slash of self closing element.
Read more >HTML Style Guide and Coding Conventions - W3Schools
Always Declare Document Type · Use Lowercase Element Names · Close All HTML Elements · Use Lowercase Attribute Names · Always Quote Attribute...
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 Free
Top 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
Ehh alright. You convinced me. I’ll release that today.
@kddnewton too bad that it was dropped as lack of this feature is a blocker for us going to 1.0.
Use case: we are cleaning up/standardizing formatting on XML that is returned to us via the Salesforce metadata API. They (salesforce) do not include a space before the
?>
on the xml version line nor do they on self closing elements. With xmlSelfClosingSpace: false the only files with a diff after the pull are ones that have a substantive change. This allows pretty-quick to run super fast because only a few files need to be prettified. With the 1.0 behavior we have thousands of files with whitespace only diffs that need to be cleaned up by prettier eliminating the significant speed improvements we get from pretty-quick.