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

react-markdown removes the escapeHtml property #594

Open
EverybodyKurts opened this issue Feb 9, 2024 · 1 comment
Open

react-markdown removes the escapeHtml property #594

EverybodyKurts opened this issue Feb 9, 2024 · 1 comment

Comments

@EverybodyKurts
Copy link

EverybodyKurts commented Feb 9, 2024

According to their changelog, react-markdown have removed the escapeHtml property in favor of using rehype plugins:

https://github.com/remarkjs/react-markdown/blob/main/changelog.md#remove-buggy-html-in-markdown-parser

In their example, they use jsx to include the rehype plugins. I'm not quite sure how to approach this problem as I'm still newish to writing f# code that compiles to js. Would https://zaid-ajaj.github.io/Feliz/#/Feliz/UsingJsx be a good starting place on how to add rehype plugins to Feliz.Markdown?

@MangelMaxime
Copy link
Contributor

MangelMaxime commented Feb 9, 2024

Would zaid-ajaj.github.io/Feliz/#/Feliz/UsingJsx be a good starting place on how to add rehype plugins to Feliz.Markdown?

This example is using interop to write code using JavaScript and then call it from F#, meaning that you would need to mix JavaScript and F# code in your project. This is not bad per se, but in general something that you probably want to avoid.

The best approach is to update the Feliz.Markdown binding to add the rehypePlugins property to it.

Pseudo code

[<Erase>]
type markdown =
	
	static member rehypePlugins (plugins : obj list) = 
		Interop.mkAttr "rehypePlugins" (ResizeArray plugins)

Here I used obj because the actual type definition is rehypePlugins?: import("unified").PluggableList | null | undefined; meaning that we would need a binding for unified package if we really wanted to be exaustive.

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