A demo project showing how to use the GitHub api with React in order to display a readme file
- Either fork or clone the repo
- Realize that we are working with the RAW files here, not the GitHub HPI
- On GitHub, browse to your README.md (or whatever else file you want as root), and copy the path
- In your react component of choice (App.js), add the GithubContextProvider and the MarkdownBrowser components.
- Update the
root
androotFile
props with the URL you got in step 3:
<GithubContextProvider root="https://raw.githubusercontent.com/<user>/<repo>/<branch>" rootFile="/README.md">
<MarkdownBrowser />
</GithubContextProvider>
- Note that the backslash is left in front of README.md - and not on the root url!
- Links are beeing rendered as buttons. Use CSS to change their look
- External links (to somewhere outside the repo) is currently not supported
- Espen Hovlandsdal for his work on react-markdown