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

Vlad Serebrennikov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 23:58:52 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)
----------------
Endilll wrote:

There could be code blocks that specify syntax in order to enable syntax highlighting, e.g. 
<pre>
```cpp
std::vector<int> v;
```
</pre>

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


More information about the llvm-commits mailing list