Confusing about the rendering #331
-
Edit update: The idea itself abuses the lib, don't do it.just bold my questions to make it easier to read. So basically I was trying to use this library as a "lightweight" editor internally to create a markdown file/"string" to be rendered. Just for myself, I know the security implication behind mdx and how the string will be evaluated unsafely. Based on the doc: overview. I should be able to use other markdown libs like For the experimental context, I was using At this point, all the radix, tailwind, bundle size are not that important internally, but when it comes to externally, if I want to use the same lib as a pure render machine. For example
Q2: Will it carry out all the radix, tailwind into the page? assuming I strip off the toolbar, editing functionality in the read-only page. If so, I still can use // from next.mdx
const H1 = ({ children }) => <h1 style={{ fontSize: '100px' }}>{children}</h1>;
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
// Allows customizing built-in components, e.g. to add styling.
h1: H1
}
}
// from mdx-editor
//then just some psedo code here,
function headingsPlugin () {
return {
h1: H1
}
}
<MDXEditor
markdown={'# Hello World'}
plugins={[headingsPlugin()]}
readonly={true}
/>; Then both should render the same, and I can have a minimal read-only render, at least I don't need to worry about tailwind typography. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Based on your questions, I'm afraid you're very mistaken about the purpose and application of this library. I'm afraid that guiding you out of that is beyond my capacity; you should take an alternative approach to your problem. |
Beta Was this translation helpful? Give feedback.
-
@petyosi, is there any way to use the MDX editor renderer for visualizing content? For example, should a microblog use MDX editor to publish new posts, is there any way to use the same MDX renderer for the posts pages? |
Beta Was this translation helpful? Give feedback.
Based on your questions, I'm afraid you're very mistaken about the purpose and application of this library. I'm afraid that guiding you out of that is beyond my capacity; you should take an alternative approach to your problem.