Compress consecutive spaces in inline code blocks.

This commit is contained in:
Denis Kasak 2019-01-16 15:42:33 +01:00
parent d6a415e54a
commit dbf5b1d6bc

View file

@ -104,9 +104,11 @@ class Formatted(object):
# Markdown inline code # Markdown inline code
elif line[i] == "`": elif line[i] == "`":
if text: if text:
# strip leading and trailing spaces from inline code blocks # strip leading and trailing spaces and compress consecutive
# spaces in inline code blocks
if attributes["code"]: if attributes["code"]:
text = text.strip() text = text.strip()
text = re.sub(r"\s+", " ", text)
substrings.append( substrings.append(
FormattedString(text, attributes.copy()) FormattedString(text, attributes.copy())