2

I need to create a documentation component that renders .md files.

I have a collection of .md files (that could potentially be stored in a DB instead of having files) and I would like to allow users do navigate the documentation and see articles.

About rendering the files I've tried most of the stuff the Google has listed am currently, I am experimenting with the component react-markdown.

I'm having trouble figuring out the code highlight peace and I was wondering if there is a component out there, that does that out of the box or that have it as a straight boolean option.

<ReactMarkdown source={file}/>

note: I've checked the answer in How do I render Markdown from a React component? and couldn't find a good one.

1
  • have you made any progress on this? I've been fondling this sort of thing for a few days now with little to no success. I can't seem to load my markdown from an external file. I was going to post my own question but thought I'd shoot you a comment and see if you've had any success. Cheers. Commented Aug 4, 2017 at 4:17

1 Answer 1

4

I solved the issue by using React Syntax Highlighter and passing it into React Markdown's renderers attribute. It has a support for Prism.js and Highlight.js syntax highlighter libraries.

Have been searching for the solution for a while, and wrote a blog post on solving the particular problem. Check it out!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.