Our application is build using Material-UI library (with themes). As part of this app we are parsing markdown to html (marked library).
How can you apply material-ui themes ( Typography ) to a pure html ?
Somehow
<div dangerouslySetInnerHTML={ {__html: marked(markdown code)}}/>
Should have the styles as defined by material-ui Typography
use regular
Typography
component and pass that HTML in a similar way as it is passed in the question.One catch is here that when
dangerouslySetInnerHTML
is passed then don't pass anything as children.Here is a working demo :
Note: Also make sure that the function
marked(markdown code)
returns the HTML in string.