Zaid-Ajaj/Feliz

`react-markdown` removes the `escapeHtml` property

Opened this issue · 1 comments

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?

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.