pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.46k stars 102 forks source link

Extend markdown support inside HTML / components #560

Open nvlang opened 10 months ago

nvlang commented 10 months ago

Markdown inside HTML tags or custom components needs to be wrapped by newlines to render correctly:

<span>*not italic*</span>

<span>
*not italic*
</span>

<span>

*italic*

</span>

This limitation includes math (i.e., $\mathrm{\TeX}$) expressions (for repos using remark-math and rehype-mathjax / rehype-katex-svelte / rehype-katex).

GuillaumeQuenneville commented 8 months ago

Math issues are tracked here https://github.com/pngwn/MDsveX/issues/302 I think the last comments have a solution to your problem.

nvlang commented 8 months ago

Math issues are tracked here #302 I think the last comments have a solution to your problem.

Thank you for the hint! I felt like this was a different enough (in particular, more specific) to warrant a separate issue, but I did read through #302 and the comments there, and did not find any solution to my issue (aside from the workaround that I already mentioned above).

pngwn commented 8 months ago

This could also be related to the fact that you can't have markdown 'in' HTML at the moment. Stuff like this doesn't work:

<span>*hi*</span>

Instead you need to have newline in between:

<span>

*hi*

</span>

This is how markdown works in general but is a limitation I plan to address.

nvlang commented 8 months ago

@pngwn I don't know how I missed that! Would it be helpful to edit this issue to address "markdown in HTML/components" in general?

pngwn commented 8 months ago

Yeah, that would be great! I thought we had an issue for this but I could not find it, so renaming this would be perfect, thank you.