RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.63k stars 10.63k forks source link

Discussion: Inline code block disabled #26865

Open DarinDev1000 opened 2 years ago

DarinDev1000 commented 2 years ago

Currently, to make a code block in a message, the 3 backticks on each end have to be on a new line. I don't mind it being that way but when importing messages from slack, slack supports inline code blocks (same with github) and they do not convert correctly. Is this an intended feature? Maybe inline full code blocks should be supported?

Example:

This works in chat:

{ "code": "block" }

This does not work:

```{
    "code": "block"
}```
dudanogueira commented 2 years ago

Hi! Thanks for pointing it out.

I marking here for discussion. I believe that the way it's working at with new parser follows a more strict approach, considering that right after the initial 3 back ticks, a convention is to define the name of the programming language to be rendered above., like so

replacing ` for ':

''' python def populate_config(self): pass '''

hugocostadev commented 2 years ago

I agree with @dudanogueira , I tried to write the same code that you send in the issue here and it does not reproduce the mentioned output:

This can generate a lot of issues, in my opinion, we should follow the current implementation.

Input:

```{
    "code": "block"
}```

Outputs:


    "code": "block"
}```
ebyrne242 commented 1 year ago

In addition to user expectations for people who are coming from slack or have been using rocket.chat for years, this also breaks message history for anyone using the new message template. We have years of messages that are still visible in search, but no longer format properly.

Some users also have the legacy message template enabled and can still send messages like this, but they don't format correctly for people on the new message template.

This was marked as fixed in #26388, but it's not as of 5.3.3.