quantizor / markdown-to-jsx

🏭 The most lightweight, customizable React markdown component.
https://markdown-to-jsx.quantizor.dev/
MIT License
2.03k stars 177 forks source link

Is it possible to create new rules and apply them? #623

Open ptitdam2001 opened 1 week ago

ptitdam2001 commented 1 week ago

Hi, I am testing markdown-to-jsx which it seems be great, but My constraint is I can't accept HTML in markdown input and I wonder if it is possible to add new rules to transform markdown syntax to react element?

I have 2 examples:

<div class="alert">This is an alert</div>

is it possible ? if true, how to do it?

quantizor commented 6 days ago

It's a planned feature in v8 which I intend to finish this winter

quantizor commented 6 days ago

If there are any missing commonmark/gfm syntaxes I could look into adding those in the meantime though. I'm not aware of a syntax for underlining, but maybe just haven't come across it.

quantizor commented 5 days ago

@ptitdam2001 in the meantime you can just use <ins>content</ins> or <u>content</u> for underlining.

For your alert use case, you can use a fenced code block and renderRule to customize behavior keyed off node.lang.

ptitdam2001 commented 5 days ago

OK Thank you for your feedback