Created
May 7, 2020 14:53
-
-
Save iksena/d5fe5851fc4162ec0902622853f59d42 to your computer and use it in GitHub Desktop.
Markdown with remark-math
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactMarkdown from 'react-markdown'; | |
import RemarkMathPlugin from 'remark-math'; | |
const _mapProps = (props) => ({ | |
...props, | |
escapeHtml: false, | |
plugins: [ | |
RemarkMathPlugin | |
], | |
renderers: { | |
...props.renderers, | |
math: ({ value }) => `math: ${value}`, | |
inlineMath: ({ value }) => `inlineMath: ${value}` | |
} | |
}); | |
const Markdown = (props) => <ReactMarkdown {..._mapProps(props)} />; | |
export default Markdown; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment