ncase / nutshell

Make expandable explanations!
https://ncase.me/nutshell/
Creative Commons Zero v1.0 Universal
504 stars 30 forks source link

YouTube and Wikipedia links that fail #13

Closed mcognetta closed 2 years ago

mcognetta commented 2 years ago

I encountered several YouTube and Wikipedia links that fail to load on Nutshell (both on my site and in your example sandbox). I would guess this affects other types of links, but I include these two since they are explicitly given as examples on your site. As a note: all of the examples in your example sandbox worked fine on my site.

I simply don't know enough to know if this is an issue with Nutshell or a problem with the specific pages that I tried to load or something else. Hope this can shed some light on it.

P.S. (so that it doesn't get lost at the bottom) This project is awesome, it is just what I've been looking for for a while.


YouTube:

[:julia](https://www.youtube.com/watch?v=N4h46_TCmGc&t=10s)

nutshell_julia_youtube

Clicking on the video produces an error and then redirects to YouTube's main page. Embedding without the timestamp works as expected.


Wikipedia:

[:Miller](https://en.wikipedia.org/wiki/Miller–Rabin_primality_test)

nutshell_wikipedia

This also happens with

[:Miller](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test)

Other notes:

I thought that it may be due to the character encoding during HTML generation ( changed to %E2%80%93 and & changed to &), but I tried writing it directly with HTML and it still didn't work.

ncase commented 2 years ago

Thank you for catching both of these bugs, with detailed testable examples @mcognetta ! I fixed both of them with the new Nutshell release (version 1.0.2)

If you're curious, the Wikipedia bug was caused by me forgetting to run the article title through decodeURIcomponent() first. Whoops. And the YouTube bug was caused by me only covering the case where the ?t= timestamp was on youtu.be links, not youtube.com. Double whoops.

Big thanks again! :tada:

mcognetta commented 2 years ago

Thank you!