Open nmain opened 5 years ago
@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 x5 slower than n°2.
So what I'm proposing is a component that implements style rules similar to line 105 here:
be added to MaterialUI.
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?
A
<RunningText>
component would apply typography styles to basic html elements in it, so something like this:Would behave like this:
Expected Behavior 🤔
Within a
<RunningText>
all of the styles normally applied by<Typography>
would be applied to the corresponding plain html elements.Current Behavior 😯
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 itsreplace
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.Examples 🌈
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
Context 🔦
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.Benchmark