CommonMark-py
CommonMark-py copied to clipboard
Non-breaking space ( ) should be preserved on rendering
Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 13:52:24)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import CommonMark as commonmark
>>> parser = commonmark.DocParser()
>>> renderer = commonmark.HTMLRenderer()
>>> renderer.render(parser.parse("big space"))
'<p>big space</p>\n'
>>> expected = '<p>big \u00A0 space</p>\n'
The CommonMark spec shows an example of
being replaced by something other than a normal space (presumably a Unicode non-breaking space character).
From a doc that the spec links to:
" ": { "codepoints": [160], "characters": "\u00A0" },
" ": { "codepoints": [160], "characters": "\u00A0" },
My example showed that the renderer translates it to a normal space, not \u00A0
. I think this is a bug in CommonMark
I can confirm this bug. The spaces are all ord(u' ') == 32
while ord(u"\u00A0") == 160
.