Skip to content

feat: render HTML documents natively in the review UI#14

Open
brendanwhit wants to merge 2 commits into
tomplex:mainfrom
brendanwhit:html-doc-rendering
Open

feat: render HTML documents natively in the review UI#14
brendanwhit wants to merge 2 commits into
tomplex:mainfrom
brendanwhit:html-doc-rendering

Conversation

@brendanwhit

Copy link
Copy Markdown
Contributor

What

add_document with a .html file currently forces the document through the markdown parser, which mangles it (e.g. <pre> truncates at blank lines) and renders it as one giant non-commentable blob on the dark app theme. This PR renders HTML docs natively:

  • Detection: prefers the server's markdown flag, falls back to the .html/.htm filename.
  • Granular blocks: walks block-level descendants of <body> (recursing through container tags like section/article) so an HTML doc splits into the same ordered, individually-commentable blocks a markdown doc does. Container ids are carried onto the first inner block so TOC anchor links keep resolving.
  • Scoped styles: the doc's own <head> <style> rules are re-applied but rescoped to .md-content.html-doc .md-block via the CSSOM, so a doc's :root { --bg: … } can't clobber the review UI's theme variables and its rules can't reach the comment chrome. Page-level box properties on body/:root are dropped (the review column provides layout).
  • Light canvas: HTML docs are authored assuming a light page, so they render on a white card with light-value theme tokens, while comment UI keeps the app theme. Wide author-laid-out content gets the pane (1400px) instead of markdown's prose column.
  • Click-to-comment works like markdown, except plain clicks on genuinely interactive targets (links, <summary>, buttons) do their native thing; shift+click force-comments anywhere.

Tests

npm run lint, npm run format:check, npm run build, npm test all green.

Second commit is the dist/ sync.

🤖 Generated with Claude Code

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