cmark

My personal build of CMark ✏️

Commit
50d3b871ad9f63907c5b19bb478aae0b6c1247a4
Parent
7e7819e05ec91bc7ca7859d119f1274cf3a83913
Author
John MacFarlane <jgm@berkeley.edu>
Date

normalize.py: don't collapse whitespace in pre contexts.

Diffstat

1 file changed, 2 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified test/normalize.py 3 2 1
diff --git a/test/normalize.py b/test/normalize.py
@@ -21,7 +21,8 @@ class MyHTMLParser(HTMLParser):
         after_block_tag = after_tag and self.is_block_tag(self.last_tag)
         if after_tag and self.last_tag == "br":
             data = data.lstrip('\n')
-        data = whitespace_re.sub(' ', data)
+        if not self.in_pre:
+            data = whitespace_re.sub(' ', data)
         if after_block_tag and not self.in_pre:
             if self.last == "starttag":
                 data = data.lstrip()