Youtube Tag
Trying to see if I can get youtube tags to get replaced with iframes, like this: <youtube>dQw4w9WgXcQ</youtube>
Seems to work perfectly. I'm using the code snippet below:
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); } }); });
If you want to add a youtube video, just <youtube>VIDEO_ID</youtube> will work!
Tetris Tag
You can easily create tetris boards using <tetris> tags!
Here's a more complex example.
