fix(embeds): resolve relative image paths in MarkdownEmbed#871
Merged
DeveloperAlly merged 2 commits intodocs-v2from Apr 8, 2026
Merged
fix(embeds): resolve relative image paths in MarkdownEmbed#871DeveloperAlly merged 2 commits intodocs-v2from
DeveloperAlly merged 2 commits intodocs-v2from
Conversation
2 tasks
- Derive baseUrl and origin from the url prop inside useEffect - Add resolveUrl() helper that passes absolute URLs, protocol-relative, data URIs, and fragment links unchanged; anchors root-relative paths to origin; resolves relative paths against baseUrl - Add escapeAttr() helper for sanitising markdown-derived alt/src values - Apply resolveUrl to markdown-style images  - Apply resolveUrl to raw HTML <img src="..."> (double-quoted) - Apply resolveUrl to raw HTML <img src='...'> (single-quoted) Fixes: broken streamplace-logo.svg in GitHub embed on /v2/solutions/streamplace/community (#gitlab-&-github section) Agent-Logs-Url: https://github.com/livepeer/docs/sessions/837ecd2d-1a07-49c5-b78d-64d964470846 Co-authored-by: DeveloperAlly <12529822+DeveloperAlly@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix GitHub embed image not rendering in home about area
fix(embeds): resolve relative image paths in MarkdownEmbed
Apr 8, 2026
DeveloperAlly
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MarkdownEmbedfetched remote markdown and converted it to HTML but had no concept of a base URL, so relative image paths (e.g.<img src="streamplace-logo.svg">in the Streamplace README) resolved against the docs origin instead of the remote file's directory — producing a broken image.Root cause
The Streamplace README header uses a raw HTML
<img>tag with a relativesrc:The previous image handling only covered markdown-syntax images
and did no URL resolution at all.Changes —
snippets/components/integrators/embeds/DataEmbed.jsxbaseUrl— derived fromurlprop (substringup to last/), guarded for no-slash edge caseorigin— extracted frombaseUrlfor root-relative path resolution (/foo.png)resolveUrl(src)— passes throughhttps://,//,data:,#unchanged; root-relative paths anchor toorigin; bare relative paths prependbaseUrlescapeAttr(str)— escapes&,",<,>for values interpolated into HTML attributes from markdown sourceupdated to useresolveUrl+escapeAttrsrc="..."and single-quotedsrc='...'— both runresolveUrlon the captured srcDescription
MarkdownEmbednow resolves relative image URLs in fetched remote markdown against the source file's base URL, fixing broken images on the Streamplace community page (/v2/solutions/streamplace/community#gitlab-&-githubsection).Scope
snippets/components/integrators/embeds/DataEmbed.jsx—MarkdownEmbedcomponent only.Validation
escapeAttroutput all confirmed correctFollow-up Tasks
none
Type of Change
Related Issues
Related to #
Changes Made
baseUrl/originderivation from theurlprop insideuseEffectresolveUrl()helper for relative → absolute URL resolutionescapeAttr()helper for HTML attribute sanitisation<img src="...">and<img src='...'>resolveUrl+escapeAttrTesting
npm run devScreenshots (if applicable)
Before — broken image (no src resolved):
After —
streamplace-logo.svgresolves tohttps://raw.githubusercontent.com/streamplace/streamplace/next/streamplace-logo.svgand renders correctly.Checklist
Additional Notes
The fix is scoped entirely to the
MarkdownEmbedconversion pipeline and does not affectSolidityEmbed,PdfEmbed, orTwitterTimelinein the same file.Governance Approval
Not required for this PR.
Copy Governance Gate - L5
Complete before requesting review. Every item must be checked or the PR is not ready.
Auto-checked by CI (lint-copy.js + lint-structure.js)
{/* REVIEW: */}flags in rendered contentpageType,audience,lastVerifiedpresent in frontmatterHuman review required
Sequence (L2)
Completeness (L3)
Tone (L4)
Brief compliance
If any structural item fails: fix before requesting review. Do not ask a reviewer to identify the issue.
If the same section fails review twice: do not attempt a third fix. Escalate to the documentation lead for L6 diagnostic.