svelte-markdown icon indicating copy to clipboard operation
svelte-markdown copied to clipboard

`isInline` option causes issues when parsing HTML

Open brunobely opened this issue 6 months ago • 0 comments

Having the isInline option in this case seems to duplicate the HTML tags. When I pass it the following as source:

<p>Enter your details below to get your <span class="text-primary">personalized</span> challenge!</p>

I get the following HTML out:

<p>
  <!-- HTML_TAG_END -->
  Enter your details below to get your
  <!-- HTML_TAG_START -->
  <span class="text-primary">
    <!-- HTML_TAG_END -->
    personalized
    <!-- HTML_TAG_START -->
  </span>
  <!-- HTML_TAG_END -->
  challenge!
  <!-- HTML_TAG_START -->
</p>
<p>
  Enter your details below to get your <span class="text-primary"></span>personalized challenge!<p>
</p>

If I omit the outerp, input (for this test case, the output is incorrect even with isInline={false}--it outputs the contents of the span twice, once in the span tag and once outside, see below):

Enter your details below to get your <span class="text-primary">personalized</span> challenge!

I get:

isInline={true}:

Enter your details below to get your <span class="text-primary"></span>personalized challenge!

isInline={false}:

Enter your details below to get your
<span class="text-primary">
  <!-- HTML_TAG_END -->
  personalized
  <!-- HTML_TAG_START -->
</span>personalized challenge!</h2>

Can't create a Svelte REPL to reproduce because of the following issue when trying to import svelte-markdown:

"Slugger" is not exported by "https://unpkg.com/[email protected]/lib/marked.esm.js", imported by "https://unpkg.com/[email protected]/src/markdown-parser.js".

brunobely avatar Aug 21 '24 22:08 brunobely