Fix #182: markdown relative URLs + prose CSS #183
No reviewers
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub!183
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-182"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #182 — rendered markdown resolved src/href verbatim, so relative images/links 404'd against the SPA route.
Resolution at render time — new
resolveMarkdownUrls(html, {owner, repo, ref, dir})inweb/src/lib/render-md.js(pure, headless-tested), applied byrenderMarkdownHtml(src, ctx?)/renderBody(src, ctx?)BEFORE the DOMPurify gate:.md/.markdown links → in-app blob view at same ref; other relative links → raw endpoint (bytes, not the blob view — documented trade-off, keeps non-renderables off the 2 MiB cap page)/= repo-root; dot-segments normalize with..clamped at root; nothing decoded/re-encoded; ?query/#frag preservedCall sites: Tree doc tabs (
docRef= display short-ref, sha fallback —refdodged: Solid drops it on components, caught live), Blob (ref + file dir), Release ({ref: tag, dir: root}); threads/previews pass no ctx (no file coordinates — documented).Sibling fix:
RepoClient.urls.rawbuilt/{o}/{r}/raw/…, a page route that never existed (404 — Blob raw pill broken too); now the §9.5?rawshape. Resolver mirrors it (pinned both sides).Prose CSS (
.markdown-body, both themes): heading scale+rules, code blocks/inline, bordered tables+zebra, tinted blockquotes, nested+task lists (:has un-bullet), hr, framed images, emerald links; threads/previews move off the deadprose-smclass.Tests:
node --test test/unit/*.test.js378/378 green (15 new in md-urls.test.js). Browser proof (real Chromium over CDP against a live server + pushed demo repo): README renders both images + navigates md→blob, sub-doc resolves../against its dir, release notes resolve at tag, dark+light screenshots, zero console errors, zero failed requests, zero broken images, nojavascript:in rendered HTML. No new deps. Decision appended to docs/go/12_web_ui.md.resolveMarkdownUrls(html, {owner, repo, ref, dir}) in render-md.js rewrites relative src/href at render time (images/other links -> ?raw byte endpoint at same ref, .md links -> in-app blob view; anchors/schemes untouched, dot-segments normalize with root clamp, no decode/re-encode). Call sites: Tree doc tabs (docRef display ref, sha fallback), Blob (ref+dir), Release (tag ref, root base); threads/previews pass no ctx (no file coordinates). Sibling fix: urls.raw built a /raw page route that never existed (404); now the 07_api 9.5 ?raw shape (also fixes the Blob raw pill). Prose pass on .markdown-body both themes; threads switch from dead prose-sm class. Headless: md-urls.test.js (15 incl. anti-laundering pins). Browser: README both themes, zero console errors, zero broken images, md->blob nav. Docs: decision appended to 12_web_ui.md.