cljoly / gohugo-asciinema

⏯️ Insert the Asciinema Player in your Hugo site with ease.
https://cj.rs/gohugo-asciinema
16 stars 3 forks source link

Multiple references to the player #1

Closed cljoly closed 2 years ago

cljoly commented 2 years ago

Multiple insertions of the shortcode, like this:

{{< asciicast src="/telescope-repo-nvim/telescope.json" poster="npt:0:04" autoplay="true" loop="true" >}}
{{< asciicast src="/telescope-repo-nvim/telescope.json" poster="npt:0:04" autoplay="true" loop="true" >}}

will result in multiple inclusion of the sources of the asciinema player, like so

<p><asciinema-player
    src="https://joly.pw/telescope-repo-nvim/telescope.json"autoplay="true"loop="true"poster="#ZgotmplZ"
></asciinema-player>
<noscript><blockquote><p>To run this asciicast without javascript, use <code>asciinema play https://joly.pw/telescope-repo-nvim/telescope.json</code> with <a href="https://asciinema.org/">Asciinema</a></p></blockquote></noscript>
<script defer src="https://joly.pw/js/asciinema-player.min.4b73e82fc0420e81fabb7d4c1fbfbb66.js"></script>
<link rel="stylesheet" type="text/css" href="https://joly.pw/css/asciinema-player.min.f5cd392f84cd7dc439349fdb0cf86482.css" />

It is not too much of a problem because at least the sources of the player are downloaded only once, but still.

I’ve attempted to use a scratchpad to recall that we have inserted the sources and don’t need to do it again, without success.

cljoly commented 2 years ago

This is now solved in 3250228e337c678b5b996f35fd2155d9b3a3608d (only in the beta of version 3 branch though)