zero-overhead markdown in your react components
import markdown /* or `md` */ from 'markdown-in-js'
const App = () => markdown`
## This is some content.
You can write _markdown_ as you'd like.
${ <span> interpolate more <Content/> </span> }
you can <i>inline *html*</i> or even <OtherComponents/>, wow
<div style=${{ fontWeight: 'bold' }}
className=<
6CB3
span class="pl-s1">${'some more styles'}
class="pl-s1">${handler}>
interpolate attributes as expected
</div>
`
- gets compiled to react elements via a babel plugin
- preserves interpolations
- built with commonmark
You can use custom components like so -
import md from 'markdown-in-js'
import { MyHeading, MyLink } from './path/to/components'
const App = () => md({ h1: MyHeading, a: MyLink })`
# this will be a custom header
[custom link component](/url/to/link)
`
- add
'markdown-in-js/babel'
to theplugins
field of your babel config - (optional) add prismjs for syntax highlighting of code blocks
- optionally no-wrap paragraphs
- optionally return array of elements
@markdown <custom>
pragma- tests!