repos / neovimcraft

website that makes it easy to find neovim plugins
git clone https://github.com/neurosnap/neovimcraft.git

commit
9559026
parent
697e008
author
Eric Bower
date
2021-08-22 21:59:47 +0000 UTC
add embedded youtube support for guides
2 files changed,  +27, -7
M src/lib/articles.json
+11, -2
 1@@ -5,7 +5,8 @@
 2       "url": "https://github.com/nanotee/nvim-lua-guide",
 3       "desc": "A guide to using Lua in Neovim",
 4       "tags": ["meta"],
 5-      "media": "https://opengraph.githubassets.com/bf01b0af4a6d4814fae6c35808e0d542bee8ce8b4449d2b64f2b40f4efc81562/nanotee/nvim-lua-guide"
 6+      "media": "https://opengraph.githubassets.com/bf01b0af4a6d4814fae6c35808e0d542bee8ce8b4449d2b64f2b40f4efc81562/nanotee/nvim-lua-guide",
 7+      "date": "2021-08-21"
 8     },
 9     {
10       "text": "What is the benefit of writing plugins in lua?",
11@@ -34,7 +35,8 @@
12       "url": "https://dev.to/2nit/how-to-make-ui-for-neovim-plugins-in-lua-3b6e",
13       "tags": ["plugins"],
14       "desc": "Let's create a simple plugin that will show us last opened files in handy side navigation.",
15-      "media": "https://res.cloudinary.com/practicaldev/image/fetch/s--AqStf1TN--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/i/p1vusfl4dhivlv7hb559.png"
16+      "media": "https://res.cloudinary.com/practicaldev/image/fetch/s--AqStf1TN--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/i/p1vusfl4dhivlv7hb559.png",
17+      "date": "2021-07-23"
18     },
19     {
20       "text": "Neovim 0.5 features and the switch to init.lua",
21@@ -66,6 +68,13 @@
22       "desc": "New to lua?  Start with us and learn!",
23       "date": "2021-07-22",
24       "media": "/lua-script.png"
25+    }, {
26+      "text": "Let's create a Neovim plugin using Treesitter and Lua",
27+      "tags": ["learn"],
28+      "url": "https://www.youtube.com/watch?v=dPQfsASHNkg",
29+      "desc": "In this video they create a Neovim plugin called 'treesitter-unit' using Lua.",
30+      "date": "2021-08-22",
31+      "media": "https://www.youtube.com/embed/dPQfsASHNkg"
32     }
33   ]
34 }
M src/routes/guides.svelte
+16, -5
 1@@ -54,12 +54,23 @@
 2       I've been compiling a list of guides that help people build and use lua plugins for neovim.
 3     </p>
 4     {#each articles as link}
 5-      <div class="article">
 6+      <div class="article"> 
 7         {#if link.media}
 8-          <a href={link.url} target="_blank">
 9-            <img src={link.media} alt={link.text} class="media" />
10-          </a>
11-        {/if}
12+          {#if link.media.includes('youtube')}
13+            <iframe 
14+              width="560" 
15+              height="315" 
16+              src="{link.media}" 
17+              title="YouTube video player" 
18+              frameborder="0" 
19+              allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
20+              allowfullscreen></iframe>
21+          {:else}
22+            <a href={link.url} target="_blank">
23+              <img src={link.media} alt={link.text} class="media" />
24+            </a>
25+          {/if} 
26+        {/if} 
27         <div class="article-header">
28           <h2>
29             <a href={link.url} target="_blank">{link.text}</a>