-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Preview #492
Comments
I’m not really sure what an MDX preview should look like. MDX is JSX in markdown. A preview for the markdown part I understand, but the JSX part seems much harder. MDX is an executable language. Should a preview execute the generated compiled JavaScript code? Should it be executed in Node.js? Or a webview? How does it know the project context? Should it assume React? How should it resolve imports? How does it know which components are injected? Should it have default styling? I’m sure there’s a way to handle all of this, and it would be really cool to see this as a third party extension, but I think it’s out of scope for this project. @wooorm WDYT? |
it’s indeed super vague because the whole point is that MDX renders something arbitrarily, depending on the rest of your code. Sure, the plain markdown part has a semantic meaning, like html, so it can be presented as something. But the ESM/expression/JSX can be rendered as anything. Actually running JS is not something I am interested in doing by default, or developing, right now. Perhaps that’s your goal. If that’s the case, for me that can and should be external. Now there is one place that renders things that has a similar case: frontmatter on GitHub. We perhaps could render the JSX components as some form of tables perhaps. Render ESM/expressions as code blocks. So in short: present the code as code, render the static semantic stuff. Mainly though: not everything needs to be done by us, or here. People can develop prototypes themselves. Different people have different needs. Go forth and build and test and see! |
This comment has been minimized.
This comment has been minimized.
I look forward to maybe seeing this as a third party extension some day, but it’s out of scope for this project. |
Initial checklist
Problem
vscode can preview Markdown but not mdx, and they won't support it. microsoft/vscode#205448
Current solutions
there was a plugin but it's outdated.
Proposed solutions
provide built-in preview functionality.
The text was updated successfully, but these errors were encountered: