@terrymooreii/sia 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/content.js +24 -21
  2. package/package.json +1 -1
package/lib/content.js CHANGED
@@ -221,28 +221,31 @@ function embedGiphyGifs(html) {
221
221
  });
222
222
  }
223
223
 
224
- // Override the link renderer to handle YouTube URLs
225
- const renderer = marked.getRenderer();
226
- const originalLink = renderer.link.bind(renderer);
227
-
228
- renderer.link = (token) => {
229
- const videoId = extractYouTubeId(token.href);
230
-
231
- if (videoId) {
232
- // Return responsive YouTube embed instead of a link
233
- return `<div class="youtube-embed"><iframe src="https://www.youtube.com/embed/${videoId}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;
234
- }
235
-
236
- const gifId = extractGiphyId(token.href);
237
-
238
- if (gifId) {
239
- // Return responsive Giphy embed instead of a link
240
- return `<div class="giphy-embed"><iframe src="https://giphy.com/embed/${gifId}" frameBorder="0" class="giphy-embed" allowFullScreen></iframe></div>`;
224
+ // Override the link renderer to handle YouTube and Giphy URLs
225
+ marked.use({
226
+ renderer: {
227
+ link(token) {
228
+ const videoId = extractYouTubeId(token.href);
229
+
230
+ if (videoId) {
231
+ // Return responsive YouTube embed instead of a link
232
+ return `<div class="youtube-embed"><iframe src="https://www.youtube.com/embed/${videoId}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;
233
+ }
234
+
235
+ const gifId = extractGiphyId(token.href);
236
+
237
+ if (gifId) {
238
+ // Return responsive Giphy embed instead of a link
239
+ return `<div class="giphy-embed"><iframe src="https://giphy.com/embed/${gifId}" frameBorder="0" class="giphy-embed" allowFullScreen></iframe></div>`;
240
+ }
241
+
242
+ // Use default link rendering for non-YouTube/Giphy links
243
+ const text = token.text || token.href;
244
+ const title = token.title ? ` title="${token.title}"` : '';
245
+ return `<a href="${token.href}"${title}>${text}</a>`;
246
+ }
241
247
  }
242
-
243
- // Use default link rendering for non-YouTube/Giphy links
244
- return originalLink(token);
245
- };
248
+ });
246
249
 
247
250
  /**
248
251
  * Generate a URL-friendly slug from a string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terrymooreii/sia",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "A simple, powerful static site generator with markdown, front matter, and Nunjucks templates",
5
5
  "main": "lib/index.js",
6
6
  "bin": {