diff --git a/matrix/colors.py b/matrix/colors.py index ba16bdd..f789f56 100644 --- a/matrix/colors.py +++ b/matrix/colors.py @@ -104,9 +104,11 @@ class Formatted(object): # Markdown inline code elif line[i] == "`": 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"]: text = text.strip() + text = re.sub(r"\s+", " ", text) substrings.append( FormattedString(text, attributes.copy())