Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD020: Breaking &nbps; not detected inbetween heading hashtags and heading title #367

Closed
muttoni opened this issue Jan 19, 2021 · 2 comments

Comments

@muttoni
Copy link

muttoni commented Jan 19, 2021

Hi, I had a devilishly difficult to track markdown issue caused by a weird space character inbetween the heading hashtags and the heading title. This was all due to the decimal charcode being 160 (non breaking space  ) instead of 32 (a regular space).

---

## Subheading that doesn't work

## Subheading that works
---

## Subheading that doesn't work

Subheading that works


Could you please detect this as an issue? As you can see, it breaks the Github markdown parser as well and it's very hard to track down unless you know the issue. I was blaming the surrounding contents for breaking the parser as Markdown Lint does not flag this as an issue (see below).

image

Edit: I initially thought this could be a rare edge case, but I've now realized what caused the nbps...typing with an IT layout means that in order to type a hashtag I need to press the Alt Gr modifier key (+ à). The modifier key also causes spacebar to generate a non-breaking space. When typing quickly it's easy to press spacebar while Alt Gr is still pressed.

@muttoni
Copy link
Author

muttoni commented Jan 19, 2021

Upon browsing the source code, this is likely falls in the MD020 category. It also might be a good time to extend the test across all types of non-admissable whitespace characters:

U+0009 Horizontal tab (HT)
U+00A0 Non-break space
U+1680 Ogham space mark
U+180E Mongolian vowel separator
U+2000 En quad
U+2001 Em quad
U+2002 En space
U+2003 Em space
U+2004 Three-per-em space
U+2005 Four-per-em space
U+2006 Six-per-em space
U+2007 Figure space
U+2008 Punctuation space
U+2009 Thin space
U+200A Hair space
U+202F Narrow no-break space
U+205F Medium mathematical space
U+3000 Ideographic space

@muttoni muttoni changed the title Breaking &nbps; not detected inbetween heading hashtags and heading title MD020: Breaking &nbps; not detected inbetween heading hashtags and heading title Jan 19, 2021
@DavidAnson
Copy link
Owner

This looks to be because the CommonMark definition of "whitespace" is more restrictive than JavaScript's RegExp:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants