Code suggestions with triple-backticks (```) in the suggested text leaks out of the suggestion block

XMLWordPrintable

    • Severity 3 - Minor

      Issue Summary

      When using the code suggestions feature in the pull request view, if the suggested replacement text itself contains a fenced code block (triple-backticks, ```), the comment does not save correctly. The suggestion's own backticks prematurely close the suggestion block, and any text after them "leaks out" and is rendered as part of the regular comment body instead of the suggestion.

      Steps to Reproduce

       1.  Open a pull request and go to the diff view.
       2.  On a line of code, start a code suggestion (the suggestions toolbar button).
       3.  In the suggestion, enter replacement text that itself contains a fenced code block, e.g.: A markdown example, a documentation snippet, or any code that includes ```
       4.  Add any additional text after the triple-backticks within the suggestion.
       5.  Save/submit the comment.

      Expected Results

      The entire suggested text (including the inner triple-backticks) is preserved inside the suggestion block, and the comment saves faithfully.

      Actual Results

      The inner ``` closes the suggestion block early. Any content after it is pushed out of the suggestion and becomes part of the normal comment message. The saved comment does not match what the author typed.

      Workaround

      Avoid including triple-backticks inside a code suggestion; suggest the change without wrapping inner fenced code blocks, or post the affected snippet as a normal comment instead of a suggestion.

              Assignee:
              Unassigned
              Reporter:
              Ellie Matsusaka Sherwood
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: