Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline code is stripped of spaces #25471

Open
schtandard opened this issue Nov 17, 2023 · 1 comment
Open

Inline code is stripped of spaces #25471

schtandard opened this issue Nov 17, 2023 · 1 comment
Labels
Bug Report/Open Bug report/issue

Comments

@schtandard
Copy link

Summary

Inline code (i.e. stuff delimited by `) is stripped of spaces, even though those may be significant and should be preserved (except for special cases). Typing inline code with leading or trailing spaces currently seems to be impossible.

Expected and observed behavior

(I am using Mattermost Version: 9.1.1, Database Schema Version: 113, Database: postgres.)

When typing inline code, all spaces should usually be preserved, as they often convey meaning. For example, if I tell someone they can make something a bullet point by prepending - to a line of text, the space is important; prepending - wouldn't work. Here are some examples of the wrong rendering.

  • ` ` should render but in fact renders  (i.e. an empty code element).
  • ` ` should render but in fact renders  (i.e. an empty code element).
  • ` x` should render x but in fact renders x.
  • `\ ` should render \ but in fact renders \.

The caveat to this is that spaces are needed as part of the markup when backticks are at the start or the end of the code. That is why Commonmark states

If the resulting string both begins and ends with a space character, but does not consist entirely of space characters, a single space character is removed from the front and back.

Here are some examples where this rule applies:

  • `` ` `` should render ` and does.
  • `` ` `` should render ` but in fact renders `.
  • ` - ` should render - but in fact renders -.
  • ` - ` should render - but in fact renders -.

More examples can be found in the Commonmark spec or in the markup of this message.

@amyblais
Copy link
Member

@amyblais amyblais added the Bug Report/Open Bug report/issue label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report/Open Bug report/issue
Projects
None yet
Development

No branches or pull requests

2 participants