metonym / svelte-highlight

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

runtime error on parsing the following text #330

Closed abbychau closed 6 months ago

abbychau commented 6 months ago
<div class="column"> <div style="position:relative;height:100%;"> {#if exists($requestedArticle.id)} <Button style="position: absolute;right: 1em; top:1em; z-index:4;" size="sm" on:click={() => { $requestedArticle = {}; }} variant="m2np" > 關閉 <Icons.X size='14' style='margin-left:0.5em' /> </Button > <div class="app-box" style="max-height: calc(100% - 83px);padding: 3px; background: #f0f0f0;" >
metonym commented 6 months ago

Could you provide a full repro? So I can better triage this.

E.g., what component are you using? What grammar are you using?

<HighlightAuto code={code} />
abbychau commented 6 months ago
    <Highlight
      language="html"
      code={text}
    />

HighlightAuto is working fine.

metonym commented 6 months ago

@abbychau "html" is not a valid grammar. Could you try using XML instead?

import xml from "svelte-highlight/languages/xml";
abbychau commented 6 months ago

ah, i just found that i just mixed up with lang and language now using

    <Highlight
      language={languages.vbscriptHtml}
      code={text}
    />

and working now

thank you for the reply.