Skip to content

Commit

Permalink
Do it a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
desertaxle committed Dec 10, 2024
1 parent 857cf3a commit 6bde400
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/pyright_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def format_markdown_table(diagnostics: list[Diagnostic]) -> str:
table = ["| File | Location | Message |", "|------|----------|---------|"]

for diag in sorted(diagnostics, key=lambda x: (x.file, x.line, x.character)):
# Escape pipe characters in the message to prevent table formatting issues
message = diag.message.replace("|", "\\|")
# Escape pipe characters and replace newlines with HTML breaks
message = diag.message.replace("|", "\\|").replace("\n", "<br>")
location = f"L{diag.line}:{diag.character}"
table.append(f"| {diag.file} | {location} | {message.replace('\n', '\\n')} |")
table.append(f"| {diag.file} | {location} | {message} |")

return "\n".join(table)

Expand Down

0 comments on commit 6bde400

Please sign in to comment.