Reputation: 157
I want to show code blocks in my react app exactly like how they have it in react routers website page, (same color scheme). How would I go about accomplishing this , I tried prettyfied from google but I kept getting an error since Im using React.js.
Here is the react router website,(how I want my code to be display, same style/color): https://reacttraining.com/react-router/web/guides/quick-start
Upvotes: 1
Views: 8716
Reputation: 968
What you're looking for is Syntax Highlighting. In ReactJS, there's a couple ways you can accomplish something like this:
Use a syntax highlighting library from NPM. I haven't really used any of these myself, but seeing as this is a common need in the world of programming, I have no doubt that one of these solutions will work well for what you're trying to do, with a little tweaking.
Use a markdown editor library from NPM. If you need something client-side (i.e. a code editor), there's a lot of user-friendly solutions out there that plug into React quite nicely.
Build it yourself. You might consider taking an approach of creating your markdown editor specific to your needs. It would be a good way for you to learn some fundamentals for manipulating input.
Best of luck!
Upvotes: 2