-
Notifications
You must be signed in to change notification settings - Fork 178
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
Allow preview component to accept React object #161
Comments
I think it makes sense and I will do it.. But question. Why do you use React mde to turn markdown into React Component? You should not do that. If you want to convert markdown into React, just use Showdown to get the HTML and then set the HTML into a |
Thank you! When a user enter markdown text (through react mde or any other means), I'd eventually need to render his text in my webpage. I could use
Super simple and safe because html escaping is on by default. Now another feature is being able to show the user a live preview of what he is typing. I could accomplish that by installing yet another dependency |
Sorry for the delay but it is now released on 7.4 |
Wow I really liked the idea of ReactMarkdown. The fact it has XSS protection is amazing. I will update the documentation now that it is possible. Thank you very much |
Fixed on 4ce9778 |
@andrerpena seems like that commit is not related to this issue. How would one use this with ReactMarkdown. It now says in the readme "Starting from version 7.4, it is also possible to return a React Element from generateMarkdownPreview" So an example with
or
|
@oskarleonard It's the second one. This is so that you have the opportunity to make Ajax calls to resolve the promise, if you want |
@oskarleonard, also, I updated the ReadMe to make it clearer that you should always return a Promise |
Just to be clear since this post is linked on the main page, oskarleonard's second example is almost there:
As it states in the docs, it must always return a promise. |
I use
react-markdown
to turn markdown text intohtmlnative react component.When passing this to
generateMarkdownPreview
function, it render it as[Object]
.Is there a possibility to make a simple check if the data is
string
then assume it's html and handle it as you do now, if it's instance ofComponent
then render it as it is?The text was updated successfully, but these errors were encountered: