From 077ff17d136cb759fa57c356cc172a63bbb11e26 Mon Sep 17 00:00:00 2001 From: Steve Fenton <99181436+steve-fenton-octopus@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:46:46 +0000 Subject: [PATCH] Updates accelerator. This resolves the issue with YT videos that aren't on their own line being expanded. --- package.json | 4 ++-- pnpm-lock.yaml | 8 ++++---- public/docs/js/modules/youtube.js | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 79f373491c..704c8b82da 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "dependencies": { "@astrojs/mdx": "^1.0.0", "astro": "^3.0.3", - "cspell": "^7.3.7", - "astro-accelerator": "^0.3.12", + "astro-accelerator": "^0.3.13", "astro-accelerator-utils": "^0.3.2", + "cspell": "^7.3.7", "hast-util-from-selector": "^3.0.0", "remark-directive": "^2.0.1", "remark-heading-id": "^1.0.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ddd786e8a..a5de3239b3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,8 +16,8 @@ dependencies: specifier: ^3.0.3 version: 3.0.3 astro-accelerator: - specifier: ^0.3.12 - version: 0.3.12 + specifier: ^0.3.13 + version: 0.3.13 astro-accelerator-utils: specifier: ^0.3.2 version: 0.3.2 @@ -1403,8 +1403,8 @@ packages: resolution: {integrity: sha512-34L9rFyjFpTCpn7qj2p3Gl8tO2TxvzBuoHUTKzfoP6Jh/aiecYDpKaxjwOj4tnr627PKU33qL9xCL8eqv/WLRg==} dev: false - /astro-accelerator@0.3.12: - resolution: {integrity: sha512-FF9V5IS7lqgq7Mp8RHW5ux6WWeoN6hNMEgHVMtZTPzLRdeU2A60FqAAuBvIpizE/MPPOEndLoJsuZFiKNcz4eg==} + /astro-accelerator@0.3.13: + resolution: {integrity: sha512-9YCp4ty+OUnYfYKetaFSqXkz32XQ+oPtetVZ1BKd8Aze6dE+D5+MFW6170p9RSDieHeG0gkl6dis7/KVTg7ZIw==} engines: {node: '>=18.14.1', pnpm: '>=8.6.12'} dependencies: '@astrojs/mdx': 1.1.1(astro@3.2.4) diff --git a/public/docs/js/modules/youtube.js b/public/docs/js/modules/youtube.js index eff51296fc..04239b8ccc 100644 --- a/public/docs/js/modules/youtube.js +++ b/public/docs/js/modules/youtube.js @@ -6,6 +6,11 @@ function enhanceYoutubeLinks() { const videos = qsa('a[href^="https://www.youtube.com/watch?v="]'); for (var video of videos) { + if (video.parentNode.childNodes.length > 1) { + // Don't turn video into embed if it's part of a longer paragraph, for example. + continue; + } + const id = new URL(video.href).searchParams.get('v'); video.setAttribute('data-youtube', id); video.classList.add('init');