René's URL Explorer Experiment


Title: feat(files): embed sim files and render mermaid diagrams in markdown preview by waleedlatif1 · Pull Request #4402 · simstudioai/sim · GitHub

Open Graph Title: feat(files): embed sim files and render mermaid diagrams in markdown preview by waleedlatif1 · Pull Request #4402 · simstudioai/sim

X Title: feat(files): embed sim files and render mermaid diagrams in markdown preview by waleedlatif1 · Pull Request #4402 · simstudioai/sim

Description: Summary Add `/api/files/view/[id]` route that resolves a file ID to its serve URL via 302 redirect (auth + access-checked) Detect relative workspace file page URLs in markdown `img` tags and rewrite them to the view API so embedded Sim files render correctly; only relative paths are rewritten to avoid SSR hydration mismatches and cross-origin URL hijacking Fix mermaid diagrams in markdown previews — add a `remarkMermaid` remark plugin that intercepts mermaid code blocks at the MDAST stage and routes them through our `MermaidDiagram` component with correct design tokens (Streamdown's built-in renderer uses mismatched Tailwind semantic classes) Reduce default trace view tree pane width from 360 → 240 Type of Change New feature Bug fix Testing Tested manually Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Add `/api/files/view/[id]` route that resolves a file ID to its serve URL via 302 redirect (auth + access-checked) Detect relative workspace file page URLs in markdown `img` tags and rewri...

X Description: Summary Add `/api/files/view/[id]` route that resolves a file ID to its serve URL via 302 redirect (auth + access-checked) Detect relative workspace file page URLs in markdown `img` tags and rewri...

Opengraph URL: https://github.com/simstudioai/sim/pull/4402

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:bbf9ab5f-4ba6-defb-e257-4d555aabf66a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9942:223074:28D83A:399213:6AFB6EFC
html-safe-nonce05a7cb812db60e5a8420f84965759cc01bcc5ba6e85f3632d9b3fdf4995454e2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTQyOjIyMzA3NDoyOEQ4M0E6Mzk5MjEzOjZBRkI2RUZDIiwidmlzaXRvcl9pZCI6IjMxNTA4Nzk3NDIwNTE5NzA4MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac63fa06c62b91c55047cfd89d76aa591433c7846d1c0a51e93ce6246a3cc32351
hovercard-subject-tagpull_request:3617363558
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/4402/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary Add `/api/files/view/[id]` route that resolves a file ID to its serve URL via 302 redirect (auth + access-checked) Detect relative workspace file page URLs in markdown `img` tags and rewri...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecca289ecd54650fcf3c0b037a58b97186dee2cc4406819d87fab93728fd83700
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release88808b1fae5ab8a526a73e7ce5542a10eb9d6971
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/4402/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F4402%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F4402%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/4402/files
Reloadhttps://github.com/simstudioai/sim/pull/4402/files
Reloadhttps://github.com/simstudioai/sim/pull/4402/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests198 (198)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/csphttps://github.com/simstudioai/sim/tree/fix/csp
Conversation 26 https://github.com/simstudioai/sim/pull/4402
Commits 18 https://github.com/simstudioai/sim/pull/4402/commits
Checks 12 https://github.com/simstudioai/sim/pull/4402/checks
Files changed https://github.com/simstudioai/sim/pull/4402/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4402/files
feat(files): embed sim files and render mermaid diagrams in markdown preview https://github.com/simstudioai/sim/pull/4402/files#top
Show all changes 18 commits https://github.com/simstudioai/sim/pull/4402/files
31850ae feat(files): resolve workspace file page URLs to raw content in markd… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/31850aefd125104c41447a5a0e8fdba1fba107a6
46f0326 refactor(files): replace regex URL matching with URL constructor in r… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/46f0326ac3acba8e4d81e1f449f8a9e491f71fb8
deb687b fix(files): render mermaid diagrams in markdown preview using design … waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/deb687b5be9242eb153b128332d1c0ab3ec89482
ea7817c fix(trace): reduce default tree pane width from 360 to 280 waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/ea7817c6d21754daeb852fdd8031588e9dda70a1
9e5dbef fix(files): guard resolveSimFileUrl against cross-origin URL hijacking waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/9e5dbef1501be0281c56faa698123c1fcf24e857
134e30d refactor(files): use getBrowserOrigin() instead of window.location.or… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/134e30d709fff569d0c23e74eeae19ced07da4f9
a1f7037 fix(trace): reduce default tree pane width to 240 waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/a1f7037f3897c4d52abea9e175e83d910ebb2c1c
701ad2b fix(files): narrow img src type before passing to resolveSimFileUrl waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/701ad2b175424303f1ce08d4e911ddeb4d38bf01
9fc1a4f fix(files): use narrow props type for img renderer instead of runtime… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/9fc1a4f7bd51c061846e929e8149005a678fe6d9
7915211 fix(files): accept full ImgHTMLAttributes for img renderer to satisfy… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/7915211055f5f9cd52ffa1baf16bad54d0da9578
d8ce2c9 fix(files): treat null getBrowserOrigin as same-origin to prevent SSR… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/d8ce2c95f50b3bdb4d3ceab834fe68f5911ae72d
95b186d improvement(files): use centered aspect-ratio skeleton for mmd file p… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/95b186d7911a55b7cf96b1a21d3a32158201a72d
2d3993f improvement(files): diagram-shaped skeleton card for mmd file preview waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/2d3993f2898fa25ad4c8d4dedb122b4e1571f801
446d9e3 fix(files): only rewrite relative workspace file URLs to avoid hydrat… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/446d9e3aa61cf545f3063321a8723d7bd2eb8b8a
9cb28da fix(files): pass context not resolved params to parseRequest in view … waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/9cb28da008a38cf2c943d6d364ec0504b04b9336
6642893 fix(files): simplify mmd file skeleton to match pptx card pattern waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/6642893df32145c5947ea88005c0cfd5da1f200a
380388c fix(files): match mmd skeleton to actual rendered layout — full-heigh… waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/380388c2b59fdb78f59744c4a7caa905bc6457e5
66207c4 fix(sidebar): left-align folder lock icon next to name waleedlatif1 May 2, 2026 https://github.com/simstudioai/sim/pull/4402/commits/66207c43ff445e80a936efb2a4d7ac2ca25ffeb5
Clear filters https://github.com/simstudioai/sim/pull/4402/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4402/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4402/files
route.ts https://github.com/simstudioai/sim/pull/4402/files#diff-c0c7b7de9bec1950223efb32e2b34a40c62a55b07d0122f860ab10768e2ac569
preview-panel.tsx https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
trace-view.tsx https://github.com/simstudioai/sim/pull/4402/files#diff-f73fd911a20f3ad980b736fa14c8bb47bee1bb576ab40ec66cb8eba63065303c
folder-item.tsx https://github.com/simstudioai/sim/pull/4402/files#diff-d0bf23590be08985090d1f3e3081773b400e76d913c283bb6a1a57518d0bae12
storage-transfer.ts https://github.com/simstudioai/sim/pull/4402/files#diff-863f7d0ace58810918b90840a39c43967e8aad8f46cb539d2dacd9c41085c36b
metadata.ts https://github.com/simstudioai/sim/pull/4402/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
apps/sim/app/api/files/view/[id]/route.tshttps://github.com/simstudioai/sim/pull/4402/files#diff-c0c7b7de9bec1950223efb32e2b34a40c62a55b07d0122f860ab10768e2ac569
View file https://github.com/simstudioai/sim/blob/66207c43ff445e80a936efb2a4d7ac2ca25ffeb5/apps/sim/app/api/files/view/%5Bid%5D/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4402/{{ revealButtonHref }}
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsxhttps://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
View file https://github.com/simstudioai/sim/blob/66207c43ff445e80a936efb2a4d7ac2ca25ffeb5/apps/sim/app/workspace/%5BworkspaceId%5D/files/components/file-viewer/preview-panel.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4402/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
Please reload this pagehttps://github.com/simstudioai/sim/pull/4402/files
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
https://github.com/simstudioai/sim/pull/4402/files#diff-262acbff6b1806a04a00b077110f4a5ef817431fe8b5014d3553b7df8b202dd2
.../workspace/[workspaceId]/logs/components/log-details/components/trace-view/trace-view.tsxhttps://github.com/simstudioai/sim/pull/4402/files#diff-f73fd911a20f3ad980b736fa14c8bb47bee1bb576ab40ec66cb8eba63065303c
View file https://github.com/simstudioai/sim/blob/66207c43ff445e80a936efb2a4d7ac2ca25ffeb5/apps/sim/app/workspace/%5BworkspaceId%5D/logs/components/log-details/components/trace-view/trace-view.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4402/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4402/files#diff-f73fd911a20f3ad980b736fa14c8bb47bee1bb576ab40ec66cb8eba63065303c
https://github.com/simstudioai/sim/pull/4402/files#diff-f73fd911a20f3ad980b736fa14c8bb47bee1bb576ab40ec66cb8eba63065303c
...eId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsxhttps://github.com/simstudioai/sim/pull/4402/files#diff-d0bf23590be08985090d1f3e3081773b400e76d913c283bb6a1a57518d0bae12
View file https://github.com/simstudioai/sim/blob/66207c43ff445e80a936efb2a4d7ac2ca25ffeb5/apps/sim/app/workspace/%5BworkspaceId%5D/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4402/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4402/files#diff-d0bf23590be08985090d1f3e3081773b400e76d913c283bb6a1a57518d0bae12
https://github.com/simstudioai/sim/pull/4402/files#diff-d0bf23590be08985090d1f3e3081773b400e76d913c283bb6a1a57518d0bae12
apps/sim/lib/api/contracts/storage-transfer.tshttps://github.com/simstudioai/sim/pull/4402/files#diff-863f7d0ace58810918b90840a39c43967e8aad8f46cb539d2dacd9c41085c36b
View file https://github.com/simstudioai/sim/blob/66207c43ff445e80a936efb2a4d7ac2ca25ffeb5/apps/sim/lib/api/contracts/storage-transfer.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4402/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4402/files#diff-863f7d0ace58810918b90840a39c43967e8aad8f46cb539d2dacd9c41085c36b
https://github.com/simstudioai/sim/pull/4402/files#diff-863f7d0ace58810918b90840a39c43967e8aad8f46cb539d2dacd9c41085c36b
https://github.com/simstudioai/sim/pull/4402/files#diff-863f7d0ace58810918b90840a39c43967e8aad8f46cb539d2dacd9c41085c36b
https://github.com/simstudioai/sim/pull/4402/files#diff-863f7d0ace58810918b90840a39c43967e8aad8f46cb539d2dacd9c41085c36b
https://github.com/simstudioai/sim/pull/4402/files#diff-863f7d0ace58810918b90840a39c43967e8aad8f46cb539d2dacd9c41085c36b
apps/sim/lib/uploads/server/metadata.tshttps://github.com/simstudioai/sim/pull/4402/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
View file https://github.com/simstudioai/sim/blob/66207c43ff445e80a936efb2a4d7ac2ca25ffeb5/apps/sim/lib/uploads/server/metadata.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4402/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4402/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
https://github.com/simstudioai/sim/pull/4402/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
Please reload this pagehttps://github.com/simstudioai/sim/pull/4402/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.