gndx / ev0-astro-theme

EV0 Astro Theme is a free and open-source serverless blog template, built with Astro, Tailwind CSS, and TypeScript.
https://ev0.gndx.dev
MIT License
162 stars 47 forks source link

Code blocks error #39

Open lazybobcat opened 7 months ago

lazybobcat commented 7 months ago

Hello, I have an issue on the code blocks and so does the theme preview at this URL: https://ev0.gndx.dev/blog/markdown-style-guide/

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')

The error comes from the Code.astro file, the variable button and check are null:

  codeBlock.forEach((code) => {
    const button = code.querySelector(".copy-button");
    const check = code.querySelector(".check-span");

It looks like the component expect the button to be there, but for some reason in the HTML the code block actually looks like

<pre class="astro-code material-theme-palenight" style="background-color:#292D3E;color:#babed8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;" tabindex="0">
<!-- ... contents ... -->
</pre>

I have no idea where this HTML comes from as I cannot find any reference to the class astro-code in the codebase.

DomeT99 commented 5 months ago

Hi guys! If you want, I can handle this problem when I have time. Let me know :)