feat(reader): full Markdown and HTML rendering for GitHub READMEs, tables, images and links

This commit is contained in:
Antigravity committed 2026-10-05 13:30:00 +03:00
1 parent c5e0e2dcfa
commit ca70580e62
5 files changed
+432 -54

No files matched your search

+8 -2
View File
@@ -294,8 +294,8 @@ def parse_text(content: str, title: str = "Untitled", author: str = "") -> Tuple
lines = content.split("\n")
first_line = lines[0].strip()
# Extract title from first line if default
if title == "Untitled":
# Extract title from first line or # Heading / <h1...> if default or generic README
if title == "Untitled" or title.lower().startswith("readme"):
if first_line.startswith("# "):
title = first_line.lstrip("# ").strip()
if len(lines) > 1:
@@ -304,6 +304,12 @@ def parse_text(content: str, title: str = "Untitled", author: str = "") -> Tuple
title = first_line.split(":", 1)[1].strip()
if len(lines) > 1:
content = "\n".join(lines[1:]).strip()
else:
h1_match = re.search(r"<h1[^>]*>(.*?)</h1>", content[:1500], re.IGNORECASE)
if h1_match:
detected = re.sub(r"<[^>]+>", "", h1_match.group(1)).strip()
if detected:
title = detected
# Extract author from next line if missing
if not author: