refactor(preview): drop the dead YouTube iframe copy from the viewer - #388
Merged
PathGao merged 1 commit intoAug 2, 2026
Merged
Conversation
MarkdownViewer.svelte still carried a pre-fix copy of the YouTube handling: isYoutubeLink, getYoutubeId and replaceWithYoutubeEmbed. The live implementation lives in src/lib/utils/markdown.ts, which renders a thumbnail anchor that opens the system browser instead of an embed. The copy had no callers, and could not have worked if it did — it builds an <iframe src="https://www.youtube.com/embed/..."> while frame-src is no longer present in the app CSP, so the frame cannot load. Its isYoutubeLink was also narrower than the live one, missing the youtube.com/embed/, /v/ and /u/ forms. youtubeExternalFallback.test.ts asserts that createElement("iframe") is absent, but only reads markdown.ts, so this copy was invisible to it. No .video-container CSS existed anywhere, so nothing else went stale with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
PathGao
added a commit
that referenced
this pull request
Aug 2, 2026
#397 shipped the "YouTube links never become embedded frames" rule with one allowlist entry for `replaceWithYoutubeEmbed` in MarkdownViewer.svelte, an uncalled pre-fix leftover it could not delete because #388 owned that file. Its comment said to delete the copy and the entry together. #388 deleted the copy; the entry stayed, so the marker now matches nothing and the meta-test that catches stale rules fires - correctly. The rule was always meant to be "allowed nowhere", which is now true. Co-authored-by: PathGao <gaoyanbo@gaoyanbodeMacBook-Air.local> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 2, 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.
MarkdownViewer.sveltestill carried a pre-fix copy of the YouTube handling —isYoutubeLink,getYoutubeIdandreplaceWithYoutubeEmbed. The live implementation is insrc/lib/utils/markdown.ts, wherereplaceWithYoutubeLinkrenders a thumbnail anchor that opens the system browser instead of an embed.The copy was dead twice over:
grep -rn 'replaceWithYoutubeEmbed\|isYoutubeLink\|getYoutubeId\|video-container' src scriptsmatched only the definitions themselves.<iframe src="https://www.youtube.com/embed/...">, butframe-srcis no longer in the app CSP (src-tauri/tauri.conf.json), so the frame cannot load at all.Its
isYoutubeLinkhad also drifted narrower than the live one, missing theyoutube.com/embed/,/v/and/u/forms.scripts/youtubeExternalFallback.test.tsasserts thatcreateElement("iframe")is absent, but reads onlymarkdown.ts— so this second copy sat outside the test's field of view.No
.video-containerCSS exists anywhere in the repo, so nothing else went stale alongside it.Verification
npm run check— 432 files, 0 errors, 0 warningsnpm test— 375 pass, 0 failcd src-tauri && cargo test— 98 pass, 0 fail🤖 Generated with Claude Code