A <RunningText> component would apply typography styles to basic html elements in it, so something like this:
<RunningText>
<h2>Foo</h2>
</RunningText>
Would behave like this:
<Typography variant="h2">Foo</Typography>
Within a <RunningText> all of the styles normally applied by <Typography> would be applied to the corresponding plain html elements.
If you want to render markdown in Material-UI, you have to use something like https://github.com/remarkjs/remark-react and its remarkReactComponents to make transformations like <h2> => <Typography variant="h2">. If you want to render arbitrary rich text from something like ProseMirror, you have to use something like https://github.com/remarkablemark/html-react-parser/ and its replace functionality to do the same. If you want to render rich text from a contenteditable with WYSIWYG, you're out of luck because there's no way to use <Typography> in the editing control of things like ProseMirror.
Blueprint.js is React component library unrelated to Material Design. It has a feature like this, documented here as "RUNNING_TEXT": https://blueprintjs.com/docs/#core/components/html
I listed some specific use cases in Current Behavior, but basically any situation where you want to render basic document content that might be dynamically generated and where using lots of <Typography> elements would be difficult.
@nmain We don't have such a component. For the markdown problem. You have two options:
n掳1 has the advantage of being fully idiomatic with React. The drawback is that it's slower than n掳2.
So what I'm proposing is a component that implements style rules similar to line 105 here: https://github.com/mui-org/material-ui/blob/2f6a982aa74ffa46680798089ad20ed67ed0c5ae/docs/src/modules/components/MarkdownElement.js#L105-277 be added to Material-UI
A similar concept component for benchmark: https://elastic.github.io/eui/#/display/text.
I'm also looking for something like this.
Bulma's content an another similar thing.
Is there any reason not to just copy MarkdownElement pretty much as-is and rename it to RunningText?
I guess remove the renderedMarkdown prop, and it might be nice to have add a prop that works like the reverse of variantMapping to map semantic elements to variants.
Would you accept a PR for something like this?
Most helpful comment
A similar concept component for benchmark: https://elastic.github.io/eui/#/display/text.