Commit f72ad6

2026-02-05 22:22:34 luxmiyu: confirm <youtube> tags work
test/c.md ..
@@ 1,5 1,28 @@
# Youtube Tag
- Trying to see if I can get youtube tags to get replaced with iframes
+ Trying to see if I can get youtube tags to get replaced with iframes, like this: `<youtube>dQw4w9WgXcQ</youtube>`
<youtube>dQw4w9WgXcQ</youtube>
+
+ Seems to work perfectly. I'm using the code snippet below:
+
+ ```js
+ document.addEventListener("DOMContentLoaded", function() {
+ const youtubeTags = document.querySelectorAll("youtube");
+
+ youtubeTags.forEach(tag => {
+ const videoId = tag.textContent.trim();
+ if (videoId) {
+ const iframe = document.createElement("iframe");
+ iframe.width = "560";
+ iframe.height = "315";
+ iframe.src = `https://www.youtube.com/embed/${videoId}`;
+ iframe.frameBorder = "0";
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
+ iframe.allowFullscreen = true;
+
+ tag.parentNode.replaceChild(iframe, tag);
+ }
+ });
+ });
+ ```
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9