Skip to content

Markdown: Preserve non-breaking spaces #3320

@infotexture

Description

@infotexture

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

--parser markdown

Input:

keep•these•words•together

(the • character is used above to represent non-breaking spaces)

Output:

keep these words together

Expected behavior:

keep•these•words•together

To support this use case, the markdown parser defaults should be adjusted to preserve non-breaking spaces, or a new configuration option added that allows users to enable this behavior as required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:markdownIssues affecting Markdownlocked-due-to-inactivityPlease 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!

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions