Closed projectashik closed 1 year ago
I am trying to add support of html tags inside markdown but haven't found any working solution yet.
Oh, yes. It certainly doesn't seem to be supported yet. I'll try to support it!
And I also want to render the custom tags.
You want to support custom tags in Markdown? More specific examples would be helpful!
I have released new version v2.0.0!
This version includes html support.
If you render HTML, you should use with rehype-raw
as rehypePlugin.
Can you help me understand what I'm doing wrong?
updated to 2.0.0, added rehype-raw
and ran pnpm install
.
"rehype-raw": "^6.1.1",
"svelte-exmarkdown": "^2.0.0",
Added a plugin
import type { Plugin } from 'svelte-exmarkdown'
import rehypeRaw from 'rehype-raw'
export const MARKDOWN_PLUGINS: Plugin[] = [
{ rehypePlugin: rehypeRaw },
...
]
<Markdown {md} plugins={MARKDOWN_PLUGINS} />
It still strips off all the HTML tags from the following content
<b>Hello</b>, <span class="text-secondary-500">world</span>!
@AgarwalPragy Thank you for using it so quickly! Hmm. I don't see why it wouldn't work. Maybe there is a problem with the order of the plugins.
Please check this demo: https://stackblitz.com/edit/svelte-exmarkdown-28-demo?file=src/App.svelte
My bad. Seems like it was an issue on my side.
I had to run the following to get it to work.
rm -rf node_modules
rm pnpm-lock.yaml
pnpm store prune
pnpm install
Weird that I had to bust the pnpm cache. 🤷
Thanks a ton for the quick reply!
Also, do you know why the official Svelte REPL is unable to handle svelte-exmarkdown?
https://svelte.dev/repl/86df1b2602ec4606990d3ffe4fad2ca5?version=3.55.1
It throws a Unexpected token (Note that you need plugins to import files that are not JavaScript)
the moment you try to import the package
Also, do you know why the official Svelte REPL is unable to handle svelte-exmarkdown?
Sorry, I don't know. 🤔
I am trying to add support of html tags inside markdown but haven't found any working solution yet. And I also want to render the custom tags.