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 .mdx files #129

Open
4 tasks done
bencmbrook opened this issue Mar 19, 2024 · 9 comments
Open
4 tasks done

Support .mdx files #129

bencmbrook opened this issue Mar 19, 2024 · 9 comments
Labels
🗄 area/interface This affects the public interface 🌊 blocked/upstream This cannot progress before something external happens first 🤞 phase/open Post is being triaged manually 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have

Comments

@bencmbrook
Copy link

bencmbrook commented Mar 19, 2024

Initial checklist

Problem

vscode-remark only recognizes markdown files

documentSelector: [{scheme: 'file', language: 'markdown'}],

but there is now a dedicated MDX language in VS Code. it would be awesome if we could use remark lint on our MDX files!

Solution

Update the documentSelector to include MDX files

Alternatives

You can force VS Code to treat MDX as Markdown, which allows vscode-remark to work, but it comes at the cost of all the other language features of MDX in VS Code via vscode-mdx

  "files.associations": {
    "*.mdx": "markdown",
  },
@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 Mar 19, 2024
@JounQin
Copy link
Member

JounQin commented Mar 19, 2024

MDX and markdown are definitely different, and there is already vscode-mdx.

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2024

This comment has been minimized.

@JounQin JounQin added the 🙋 no/question This does not need any changes label Mar 19, 2024

This comment has been minimized.

@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 Mar 19, 2024
@remcohaszing
Copy link
Member

vscode-mdx provides MDX language support. I would also like to see unified-engine based remark support for MDX.

Related issues:

I think those issues need to be resolved first. Then we can investigate support in remark-language-server / vscode-remark. We can implement something like probing in vscode-eslint.

@remcohaszing remcohaszing reopened this Mar 19, 2024
@github-actions github-actions bot removed 👎 phase/no Post cannot or will not be acted on 🙋 no/question This does not need any changes labels Mar 19, 2024

This comment has been minimized.

@remcohaszing remcohaszing added 🦋 type/enhancement This is great to have 🗄 area/interface This affects the public interface 🧒 semver/minor This is backwards-compatible change 🤞 phase/open Post is being triaged manually labels Mar 19, 2024
@bencmbrook
Copy link
Author

bencmbrook commented Mar 19, 2024

Thank you! Yes my use-case is aligned to that @remcohaszing — showing our remark lint issues in MDX files with IntelliSense.

Our workaround works perfectly today for linting MDX with vscode-remark (by using remark-mdx in our .remarkrc file and forcing VS Code to treat MDX as Markdown via "files.associations") but it comes at the tradeoff of the vscode-mdx extension no longer recognizing the file, since it's treated as Markdown.

@bencmbrook
Copy link
Author

@remcohaszing given the extension works with MDX in our workaround... in theory, would updating this to simply include MDX files work?

documentSelector: [{scheme: 'file', language: 'markdown'}],

Ideally there would be an exposed setting as well that toggles that so it's opt-in. Also understand if you prefer to go with the more foundational work of handling rule overrides.

@Ayc0
Copy link

Ayc0 commented Jun 16, 2024

Cf https://github.com/orgs/mdx-js/discussions/2067#discussioncomment-3023340

Remark-cli and thus remark-vscode are the recommended tools to format MDX

@bencmbrook
Copy link
Author

bencmbrook commented Jun 17, 2024

Cf https://github.com/orgs/mdx-js/discussions/2067#discussioncomment-3023340

Remark-cli and thus remark-vscode are the recommended tools to format MDX

Yeah I'm using that for CLI formatting today, but this issue is primarily about highlighting lint errors in the same way that Prettier would, like so:

Screenshot 2024-06-17 at 10 37 15 AM

This is forcebly enabled for MDX in my VSCode via the method described in the Alternatives section in the issue. And these rules are specified via .remarkrc, which includes the remark-vscode plugin

@remcohaszing remcohaszing added the 🌊 blocked/upstream This cannot progress before something external happens first label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 🌊 blocked/upstream This cannot progress before something external happens first 🤞 phase/open Post is being triaged manually 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have
Development

No branches or pull requests

4 participants