-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Markdown: Preserve non-breaking spaces #3320
Copy link
Copy link
Closed
Labels
lang:markdownIssues affecting MarkdownIssues affecting Markdownlocked-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.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:markdownIssues affecting MarkdownIssues affecting Markdownlocked-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.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 currently replaces all non-breaking spaces with standard space characters.
This makes sense in JavaScript or other source file formats where they may have been entered inadvertently — but when they appear in Markdown, they are most likely intentional and should not be discarded.
(In prose writing, non-breaking spaces are often essential to keep numbers and units together, or ensure multi-word product names aren't torn apart.)
Prettier 1.8.2
Playground link
Input:
(the • character is used above to represent non-breaking spaces)
Output:
Expected behavior:
To support this use case, the
markdownparser defaults should be adjusted to preserve non-breaking spaces, or a new configuration option added that allows users to enable this behavior as required.