File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -108,14 +108,28 @@ def affected_nix_packages() -> str:
108108
109109 def additional_comment () -> str :
110110 if comment :
111- escaped_comment = comment .replace ("`" , "\\ `" )
111+ # Find the maximum number of consecutive backticks in the comment
112+ max_backticks = 0
113+ current_backticks = 0
114+
115+ for char in comment :
116+ if char == "`" :
117+ current_backticks += 1
118+ max_backticks = max (max_backticks , current_backticks )
119+ else :
120+ current_backticks = 0
121+
122+ # Use at least 3 backticks, or one more than the maximum found in
123+ # order to escape accidents or attempts at escaping the code block
124+ fence_backticks = "`" * max (3 , max_backticks + 1 )
125+
112126 return f"""
113127
114128## Additional comment
115129
116- ```
117- { escaped_comment }
118- ``` """
130+ { fence_backticks }
131+ { comment }
132+ { fence_backticks } """
119133 else :
120134 return ""
121135
You can’t perform that action at this time.
0 commit comments