Skip to content
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

Closed
4 tasks done
ianzone opened this issue Jan 11, 2025 · 4 comments
Closed
4 tasks done

Support Preview #492

ianzone opened this issue Jan 11, 2025 · 4 comments
Labels
🤷 no/invalid This cannot be acted upon 👎 phase/no Post cannot or will not be acted on

Comments

@ianzone
Copy link

ianzone commented Jan 11, 2025

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.

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jan 11, 2025
@remcohaszing
Copy link
Member

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?

@wooorm
Copy link
Member

wooorm commented Jan 17, 2025

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!

@remcohaszing remcohaszing closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025

This comment has been minimized.

@remcohaszing remcohaszing added the 🤷 no/invalid This cannot be acted upon label Jan 17, 2025
@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Jan 17, 2025
@remcohaszing
Copy link
Member

I look forward to maybe seeing this as a third party extension some day, but it’s out of scope for this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷 no/invalid This cannot be acted upon 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants