Skip to content

fix(index): render markdown properly and resolve relative image paths - #107

Merged
yichuan-w merged 3 commits into
mainfrom
fix/improve-text-rendering
Jun 27, 2026
Merged

fix(index): render markdown properly and resolve relative image paths#107
yichuan-w merged 3 commits into
mainfrom
fix/improve-text-rendering

Conversation

@yichuan-w

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #101. Improves text file rendering in the index pipeline:

  • .md files now render as real HTML — uses the markdown library (with tables + fenced_code extensions) instead of html.escape() + <pre>. Headings, tables, code blocks, links, and blockquotes all render correctly. .txt files keep the <pre> wrapping.
  • Relative image paths resolve correctly — rewrites relative src/href attributes to absolute file:// URIs so local images (e.g. ![](docs/img.png)) load during CDP rendering.
  • Temp directory auto-cleanup — switches from tempfile.mkdtemp() to TemporaryDirectory context manager.
  • Adds markdown>=3.4 to the index extra in pyproject.toml.

Test plan

  • Rendered our own README.md locally — banner image, pipeline diagram, tables, code blocks all display correctly
  • Verified .txt files still render as monospace <pre> blocks
  • Confirmed chunk.py processes the resulting tiles without issues

Follow-up to #101. The original implementation wrapped all text file
content in <pre> tags with html.escape(), so markdown syntax showed as
raw text. This changes .md files to use the markdown library (with
tables + fenced_code extensions) for proper rendering, while keeping
<pre> for .txt files. Also rewrites relative src/href paths to absolute
file:// URIs so local images load correctly during CDP rendering, and
switches to TemporaryDirectory for automatic cleanup.
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 27, 2026 7:58am

@yichuan-w
yichuan-w merged commit 83ccea4 into main Jun 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant