Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ptitdam2001 opened this issue Nov 18, 2024 · 4 comments
Open

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

ptitdam2001 opened this issue Nov 18, 2024 · 4 comments

Comments

@ptitdam2001
Copy link

ptitdam2001 commented Nov 18, 2024

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:

  • I would like transform the next markdown ++underlined text++ to <ins>underlined text</ins>,
  • I would like transform
--- alert
This is an alert
---

to

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

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

@quantizor
Copy link
Owner

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

@quantizor
Copy link
Owner

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
Copy link
Owner

@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
Copy link
Author

OK Thank you for your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants