Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save henrahmagix/919f674fba7256be1df2 to your computer and use it in GitHub Desktop.
Save henrahmagix/919f674fba7256be1df2 to your computer and use it in GitHub Desktop.
No-break spaces don't work in Markdown titles in GitHub comments

See comment below. (It renders fine here but shows an indentation.)

Screenshot:

image

In the atom editor, a no-break space (alt+space on OSX) is shown as a small dot.

image

In Sublime Text 2 and 3, with draw_white_space: all, it renders as blank whereas a regular space is a small dot.

Sublime Text 2
Sublime Text 3

Source:

# Regular space after `#`

# No-break space after `#`
@henrahmagix
Copy link
Author

Regular space after #

 No-break space after #

@omgmog
Copy link

omgmog commented Jan 20, 2015

This is exactly as I would expect it to work, the Markdown parser should be differentiating between ' ' and ' ', so while # some text should be correctly parsed as a h1, #&bsp;some text shouldn't.

Github uses the redcarpet Markdown parser, and looking at the source you can see that it expects 1-6 #'s followed by one (space).

As in your editor, it would be nice to have some visual indicator that a non breaking space has been typed in the Github editor/comments rather than a regular space.

@henrahmagix
Copy link
Author

Does the Markdown parser differ between Gists and Comments? In comments it breaks (as, you say, expected), but in a Gist it renders fine.

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