Summary
Oxfmt currently rewrites HTML like:
<!DOCTYPE html>
<meta charset="utf-8">
into:
<!doctype html>
<meta charset="utf-8" />
The trailing slash does not make an HTML void element self-closing; HTML ignores it. This output also conflicts with HTML validators configured to require the conventional uppercase doctype and omit the misleading slash on void elements.
Request
Please consider either:
- HTML-specific options for doctype case and void-element style; or
- defaults that emit
<!DOCTYPE html> and omit the slash from HTML void elements.
The current Oxfmt configuration reference documents HTML formatting options such as singleAttributePerLine and htmlWhitespaceSensitivity, but no controls for these two output choices.
Reproduction
With Oxfmt 0.58.0 (and after reviewing the 0.59.0 configuration reference):
printf "<!DOCTYPE html>\\n<meta charset=\\"utf-8\\">\\n" | oxfmt --stdin-filepath example.html
outputs:
<!doctype html>
<meta charset="utf-8" />
Downstream impact
Calavera is adding html-validate as an opt-in integration. We do not want to disable HTML formatting wholesale or weaken the validator defaults, so users selecting both tools currently need to review this known incompatibility. A formatter option would let both tools coexist without excluding HTML.
Summary
Oxfmt currently rewrites HTML like:
into:
The trailing slash does not make an HTML void element self-closing; HTML ignores it. This output also conflicts with HTML validators configured to require the conventional uppercase doctype and omit the misleading slash on void elements.
Request
Please consider either:
<!DOCTYPE html>and omit the slash from HTML void elements.The current Oxfmt configuration reference documents HTML formatting options such as
singleAttributePerLineandhtmlWhitespaceSensitivity, but no controls for these two output choices.Reproduction
With Oxfmt 0.58.0 (and after reviewing the 0.59.0 configuration reference):
outputs:
Downstream impact
Calavera is adding
html-validateas an opt-in integration. We do not want to disable HTML formatting wholesale or weaken the validator defaults, so users selecting both tools currently need to review this known incompatibility. A formatter option would let both tools coexist without excluding HTML.