From 8f0a42c96476d9a8cb03e928017c9e5245fe8868 Mon Sep 17 00:00:00 2001 From: Michael Uloth Date: Sun, 22 Dec 2024 22:49:45 -0500 Subject: [PATCH] remark: generate youtube embed markup from obsidian youtube image links --- lib/remark/plugins.ts | 2 ++ lib/remark/youtube-embed-from-image-link.ts | 40 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 lib/remark/youtube-embed-from-image-link.ts diff --git a/lib/remark/plugins.ts b/lib/remark/plugins.ts index af015586..47a62971 100644 --- a/lib/remark/plugins.ts +++ b/lib/remark/plugins.ts @@ -3,6 +3,7 @@ import remarkWikiLink from '@portaljs/remark-wiki-link' import remarkLastModified from './last-modified' import remarkRemoveTags from './remove-tags' +import remarkYouTubeEmbedFromImageLink from './youtube-embed-from-image-link' export default [ remarkLastModified, @@ -17,4 +18,5 @@ export default [ wikiLinkResolver: (slug: string): string[] => [`${slug}/`], // expects all pages to have root-level paths }, ], + remarkYouTubeEmbedFromImageLink, ] diff --git a/lib/remark/youtube-embed-from-image-link.ts b/lib/remark/youtube-embed-from-image-link.ts new file mode 100644 index 00000000..27f23f41 --- /dev/null +++ b/lib/remark/youtube-embed-from-image-link.ts @@ -0,0 +1,40 @@ +// Obsidian uses ![](