question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Muliple NBSPs in code secontion in markdown string are collapsed

See original GitHub issue

Prettier 2.7.1 Playground link

--parser markdown

Input:

For example, the string `"a   b"` (three spaces between _a_ and _b_) separates _a_ and _b_ more than `"a b"` (one space between _a_ and _b_).

Output:

For example, the string `"a b"` (three spaces between _a_ and _b_) separates _a_ and _b_ more than `"a b"` (one space between _a_ and _b_).

Expected behavior: I replaced regular spaces with Non-breaking spaces to prevent the collapsing of the spaces that occurs with regular spaces, but if you look at "a   b" it shouldn’t be collapsed as it renders correctly.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kachkaevcommented, Oct 8, 2022
2reactions
thorn0commented, Sep 22, 2022

original the doc had 3 regular spaces “a b” that does collapse down

It’s collapsed by the browser. In the HTML markup, it’s still 3 spaces. I’d vote for removing this replace unless there really is a case when it’s doing the right thing.

Actually, according to the CommonMark spec, the only correct replacement would be to replace line endings with spaces.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a markup for multiple spaces in code?
I would like to put a string of spaces in code in an SO answer: ddl1.Items.Add("12 34"). Without code, I can use  ...
Read more >
How do I ensure that whitespace is preserved in Markdown?
Markdown is used primarily to generate HTML, and HTML collapses white spaces by default. Use   instead of space characters.
Read more >
Multiple spaces in backticks - Spec - CommonMark Discussion
I use inline backticks only to show code portions or string constants. Dropping spaces for such cases looks very bad idea. At least,...
Read more >
Markdown Syntax - dotCMS
Learn about markdown that allows you to write using an easy-to-read and write plain text format, which converts to valid HTML for viewing...
Read more >
Allow for preserving non-semantic whitespace and softbreaks
Problem Using the library I noted that the content of the markdown is not dealing properly with multiples whitespaces.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found