Change suggestions to use 4 backticks instead of 3
The most common use case for a codeblock is to use three backticks, and this is what we use for our documentation as well. In fact, it doesn't matter if you use 3 or 4 backticks, or 3 or 4 tildes, the result will be the same, the CommonMark spec supports it:
The content of the code block consists of all subsequent lines, until a closing code fence of the same type as the code block began with (backticks or tildes), and with at least as many backticks or tildes as the opening code fence.
Since the majority of users and docs style guides use backticks (tildes are only known to a handful of users I think), we can safely interchange between them and change the default behavior of the suggestions.
What does this MR do?
In case a a multi-line suggestion includes a codeblock though, it will have the backticks of the suggestion block, plus the backticks of the diff. In that case, the Markdown renderer won't render it correctly.
Example suggestion that will fail:
```suggestion: -0+0
```sh
./run.sh
```
```
To overcome this, we can use 4 backticks instead of 3 in a suggestion block:
````suggestion: -0+0
```sh
./run.sh
```
````
Screenshots/videos
Test MR axil/playground!13 (diffs).
Raw suggestion | Wrong preview | Correct preview |
---|---|---|
I recorded a video that demonstrates this (using 4 backticks by default).
Closes #28715 (closed)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team