react-markdown-github

React component that renders Markdown similarly to Github's formatting

Usage no npm install needed!

<script type="module">
  import reactMarkdownGithub from 'https://cdn.skypack.dev/react-markdown-github';
</script>

README

react-markdown-github

A React component that wraps react-markdown that:

Installation

npm install react-markdown-github

Usage

<MarkdownGithub 
  source={ markdown } 
  sourceUri='https://github.mycorp.com/org/component/blob/master/README.md'  
  transformLinkUri={ ({ uri, github, org, repo, filename, filepath }) => { } }
  transformImageUri={ ({ uri, github, org, repo, filename }) => {} }
  renderers={ code: myCodeFormatter } 
  className='myClass' />

Component Properties

  • sourceUri Absolute URL to orgional markdown. All relative links will be resolved relative to this URL.
  • transformLinkUri URL resolver function. To override the URL resolver and point a url to an alternate location.
  • transformImageUri image URL resolver function. Default behavior is to not modify image urls.
  • renderers An object of render function values with keys corresponding to Node Type to be passed to react-markdown.
  • className the CSS class passed to react-markdown.

Test

npm test
LICENSE: MIT