Skip to content

Commit 5a02ae3

Browse files
fix: escape newlines in markdown table cells (#22)
- Replace newlines with HTML <br> tags in table cells - Prevents markdown table rendering issues with multiline content - Fixes display of discrepancies with multiline API behavior messages
1 parent 26c0291 commit 5a02ae3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/generate_docs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import json
77
import sys
8-
from datetime import datetime, timezone
8+
from datetime import UTC, datetime
99
from pathlib import Path
1010

1111
from rich.console import Console
@@ -39,7 +39,7 @@ def generate_modifications_page(report: dict | None, output_path: Path) -> None:
3939
]
4040

4141
# Add generation timestamp
42-
now = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
42+
now = datetime.now(UTC).strftime("%Y-%m-%d %H:%M UTC")
4343
lines.extend(
4444
[
4545
f"*Last updated: {now}*",
@@ -167,7 +167,9 @@ def _format_value(value) -> str:
167167
return (
168168
f"`{json.dumps(value)[:50]}...`" if len(str(value)) > 50 else f"`{json.dumps(value)}`"
169169
)
170-
return f"`{value}`"
170+
# Replace newlines with HTML line breaks for markdown tables
171+
str_value = str(value).replace("\n", "<br>")
172+
return f"`{str_value}`"
171173

172174

173175
def _get_type_badge(dtype: str) -> str:

0 commit comments

Comments
 (0)