Skip to content

Prettier kills non-breaking spaces in HTML and angular #5796

@kondi

Description

@kondi

Prettier 1.16.1
Playground link

--parser html

Input:

Prix : 32 €

Output:

Prix : 32 €

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 html or angular parser is used. In jsx and markdown they 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:htmlIssues affecting HTML (and SVG but not JSX)locked-due-to-inactivityPlease 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!status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions