metonym / svelte-highlight

Syntax Highlighting for Svelte using highlight.js
https://svhe.onrender.com
MIT License
253 stars 13 forks source link

Error - value.replace is not a function #237

Closed mertgibi closed 1 year ago

mertgibi commented 1 year ago

im using svelte-highlight in my project

highlight.svelte - component

<script>
    import { HighlightAuto } from "svelte-highlight";
    import atomOneDark from "svelte-highlight/styles/atom-one-dark";

    export let html
    const code = html
</script>

<svelte:head>
    {@html atomOneDark}
</svelte:head>

<HighlightAuto {code} />

error image

but... but i don't get this error if used like this

highlight.svelte - component

<script>
    import { HighlightAuto } from "svelte-highlight";
    import atomOneDark from "svelte-highlight/styles/atom-one-dark";

    const code = ".body { padding: 0; margin: 0; }";
</script>

<svelte:head>
    {@html atomOneDark}
</svelte:head>

<HighlightAuto {code} />
mertgibi commented 1 year ago

okay, i solved

HTML variable is array