In this UX-focused discussion, szhorvat reports that consecutive spaces within inline code (e.g., o o) are collapsed during rendering in Discourse, which interferes with visual representation of spacing-dependent content like diagrams. Canapin clarifies this is not a Discourse bug but standard behavior of the markdown-it parser, which aligns with browser defaults for <code> elements. A workaround is to apply custom CSS: code { white-space: pre-wrap; } — though this requires a paid plan for hosted Discourse sites (Canapin). mattdm notes this behavior is not CommonMark-compliant, citing that “interior spaces are not collapsed” per spec. Attempts to use non-breaking spaces were found ineffective after post-processing (Canapin, mattdm). szhorvat confirms the CSS fix works on their free open-source-hosted site (free.discourse.group). Finally, sam confirms the behavior is intentional UI design, not a markdown parsing error, and moves the thread to ux.
It’s unclear to me whether this is intentional or a bug, but if it’s intentional, I do not really see the point. As you can see above, it can be counterproductive. If one does not want extra spaces, it is easy to delete them manually. The point of code blocks (whether inline or separate) is to include verbatim text with a fixed-width font.
I am moving this to Contribute > UX, this is working as designed there was a deliberate decision by the design team to collapse the spaces in the ui, the markdown itself is correct.