-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Prettier kills non-breaking spaces in HTML and angular #5796
Copy link
Copy link
Labels
lang:htmlIssues affecting HTML (and SVG but not JSX)Issues affecting HTML (and SVG but not JSX)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
Milestone
Metadata
Metadata
Assignees
Labels
lang:htmlIssues affecting HTML (and SVG but not JSX)Issues affecting HTML (and SVG but not JSX)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
Prettier 1.16.1
Playground link
Input:
Output:
Expected behavior:
It is not visible, but the character between the x and colon, also between the number 2 and euro sign are non-breaking narrow spaces (https://www.fileformat.info/info/unicode/char/202f/index.htm). These characters are replaced with normal spaces currently when the
htmlorangularparser is used. Injsxandmarkdownthey are handled well, thanks to the fixed issues: #5077 (jsx) #3320 (markdown).Reasoning:
In French grammar you have to put this space before the colon, exclamation mark, percent symbol etc (https://en.wikipedia.org/wiki/Non-breaking_space#Width_variation). It is a bit narrower than an normal space, and it won't be broken into multiple lines.