Need help on my Markdown Previewer

I have two large problems with what I made.

  1. I’m using dangerouslySetInnerHTML to render the marked text. But I’m uncomfortable with this solution since setting innerHTML is a risky and often times poor practice in general.

  2. I honestly have no idea how to get links rendered with markup to open in new tags. I honestly think that’s harder than getting the parser to recognize carriage returns as <br> tags. I have not seen a good way to add target="_blank" to my link tags in markup at all.

Any other criticism is also welcome but these were the two glaring issues I saw.

  1. Yes, that is less than ideal. But this is also just a little toy app - I wouldn’t worry about that. You can go look at the documentation for that library and see if they offer a better solution - if they don’t, I wouldn’t worry too much about it for this specific app.

  2. Yeah, that is an issue. I think in this thread we discussed a solution for that.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.