* Add html whitespace tests * `U+0005` -> `U+2005` * Update tests * Fix whitespace * Add changelog * Another space * Restore `non-breaking` check * Add space between tests * Extract all space related codes to utils * Fix indent detect * Update changelog * Another space * Rename * Rename * Rename * Use `htmlTrimFirstLine` and `htmlTrimEnd` * Assert with output * `htmlTrimPreserveIndentation` * Update changelog * Fix another space
663 B
663 B
Preserve non-ASCII whitespace characters in HTML (#8137 by @fisker)
Non-ASCII whitespace characters like U+00A0 U+2005 etc. are not considered whitespace in html, they should not be removed.
// Prettier stable
[...require("prettier").format("<i> \u2005 </i>", { parser: "html" })]
.slice(3, -5)
.map((c) => c.charCodeAt(0).toString(16));
// -> [ '20' ]
// `U+2005` is removed
// Prettier master
[...require("prettier").format("<i> \u2005 </i>", { parser: "html" })]
.slice(3, -5)
.map((c) => c.charCodeAt(0).toString(16));
// -> [ '20', '2005', '20' ]