fix(core): allow data: URIs in markdown images + e2e test (#2505)#2881
Conversation
|
@coderabbitai review |
🦋 Changeset detectedLatest commit: 97a0bd8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Actions performedReview triggered.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a Playwright E2E test that verifies a markdown-embedded image in an element's description renders and loads; updates the test model to include the embedded image; updates sanitization to allow Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@e2e/src/likec4/model.c4`:
- Line 19: The model.c4 E2E fixture includes an external image link ("") which creates an external network
dependency; replace this URL with a repo-local static test asset (e.g., add a
file under e2e/assets or e2e/fixtures likec4-favicon.svg and update the image
reference in model.c4 to point to that local path), ensure the static asset is
committed to the repo, and verify any test harness that reads model.c4 can
resolve local relative paths so CI no longer depends on external network
availability.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1aaafb3c-57e4-482f-ab73-fadb2f90fcd7
📒 Files selected for processing (3)
e2e/.gitignoree2e/src/likec4/model.c4e2e/tests/markdown-image.spec.ts
|
@coderabbitai review |
566ac90 to
efcb1e3
Compare
✅ Actions performedReview triggered.
|
Adds a remote image URL to the cloud element's triple-quoted description and a Playwright test that opens element details and verifies the <img> tag both exists in the DOM and actually loads (naturalWidth > 0). Confirms markdown images work correctly with triple-quoted descriptions. Issue #2505 is a documentation gap, not a code bug. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@coderabbitai review |
efcb1e3 to
fde56d7
Compare
✅ Actions performedReview triggered.
|
Signed-off-by: Denis Davydkov <denis@davydkov.com>
Summary
Two changes for #2505 (images don't display in markdown):
1. Fix: Allow data: URIs in markdown image src
The
rehype-sanitizedefault schema only allowshttpandhttpsprotocols forimg.src. Data URIs (data:image/...) were stripped, leaving<img>tags without asrcattribute.Added
datatoprotocols.srcin the sanitizer config so inline images work.File:
packages/core/src/utils/markdown/to-html.ts2. E2E test: Markdown image rendering
Playwright test that opens element details for the cloud element (which has a triple-quoted description with
) and verifies the image loads (naturalWidth > 0).Files:
e2e/src/likec4/model.c4,e2e/tests/markdown-image.spec.ts,e2e/.gitignoreNote on #2505
The main issue reported in #2505 is likely a documentation gap — users need to use triple quotes (
'''...''') for markdown descriptions, as documented inapps/docs/src/content/docs/dsl/model.mdx. Single-quoted descriptions are plain text by design.Relates to #2505
🤖 Generated with Claude Code