Suggestion closing marker (```) conflicts with Markdown code block closing marker #76840
Unanswered
scy
asked this question in
Pull Requests
Replies: 1 comment 1 reply
-
Why not simply have the four-backticks variant there by default? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Bug
Body
When code reviewing a Markdown document, you might come across a case where you’re adding a comment to multiple lines of code, and they include a code block, e.g.
Now, suppose you’d like to use the “add suggestion” feature to propose a change. The comment field will now contain something like this:
As you can see, there’s now two
```
closing markers in the comment, and sure enough, GitHub will think your suggestion ends after the first one (i.e. belowtouch grass
).It’s nice
won’t be interpreted as part of the suggestion anymore.Now, there’s a way to work around this. When a code block is supposed to contain a closing marker as part of its content, Markdown allows you to increase the number of backticks around that block to remove the ambiguity. For our suggestion, that could look like this:
(Note that
````suggestion
now starts with four backticks, and there’s also four backticks in the last line.)However, the “add suggestion” button should do this automatically, and right now it doesn’t. I had to manually fix the Markdown created by the button.
I think most people won’t know about this Markdown syntax feature at all, and the suggestion button should do the right thing nevertheless. The algorithm could be something like this:
^`{3,}$
, remember the number of backticks it has in a set or similar data structure.```suggestion
and the closing marker.Beta Was this translation helpful? Give feedback.
All reactions