commonmark / commonmark-spec

CommonMark spec, with reference implementations in C and JavaScript
http://commonmark.org
Other
4.89k stars 317 forks source link

Example 333 actually strips nothing #753

Closed rhysd closed 1 year ago

rhysd commented 1 year ago

Example 333:

Only [spaces], and not [unicode whitespace] in general, are
stripped in this way:

```````````````````````````````` example
` b `
.
<p><code> b </code></p>


If the description is correct, spaces around 'b' must be stripped as `<p><code>b</code></p>`. But the example is not stripped actually.

On GitHub, these spaces are actually stripped. `` ` b ` `` is ` b ` as rendered here.
wooorm commented 1 year ago

Those characters are not spaces but U+00A0 (No-Break Space, NBSP). The line above explains it: only the actual ASCII space (U+0020) is removed in this case.

See:

` b ` ->  b 

` b ` -> b

Note that copy/pasting things might loose these characters. Code editors might not display the difference, but they often have a “show hidden characters” option, see also “Unicode highlight” in VS Code settings

rhysd commented 1 year ago

Ah, I see. I misunderstood that nbsp is included in the 'spaces' in CommonMark. Thank you for clarifying that.