[llvm] [Github] Improve formating of PR diffs in bot notifications (PR #66118)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 00:00:07 PDT 2023


================
@@ -47,6 +47,21 @@ def _get_curent_team(team_name, teams) -> Optional[github.Team.Team]:
     return None
 
 
+def escape_description(str):
+    # https://github.com/github/markup/issues/1168#issuecomment-494946168
+    str = html.escape(str, False)
+    # '@' followed by alphanum is a user name
+    str = re.sub("@(?=\w+)", "@<!-- -->", str)
+    # '#' followed by digits is considered an issue number
+    str = re.sub("#(?=\d+\s)", "#<!-- -->", str)
+    return str
+
+
+def sanitize_markdown_code_block(str):
+    # remove codeblocks terminators
+    return re.sub("^\s*```\s*$", r"` ` `", str)
----------------
cor3ntin wrote:

we only need to escape the closing ` ``` `

```
```cpp does not close a code block 
```

https://github.com/llvm/llvm-project/pull/66118


More information about the llvm-commits mailing list