extensions icon indicating copy to clipboard operation
extensions copied to clipboard

MDX

Open okdistribute opened this issue 3 years ago • 10 comments
trafficstars

Is your feature request related to a problem? Please describe. md syntax highlighting works great, but mdx is not supported. MDX allows you to mix and match JSX with markdown content.

Describe the solution you'd like Allow markdown syntax highlighting with mdx files using an off-the-shelf syntax highlighter. VSCode plugin example

Describe alternatives you've considered Treat mdx as md, and it won't parse the JS correctly but that's OK, at least the markdown will be highlighted.

Thanks!

okdistribute avatar Jun 22 '22 20:06 okdistribute

Partial support for this should be landing in v0.40.0. By partial support, I mean that everything that is highlighted in a .md file will be highlighted in a .mdx file. From what I can tell, this is just a temporary solution and full support will come later on.

JosephTLyons avatar Jun 22 '22 22:06 JosephTLyons

Works for me! Thanks

okdistribute avatar Jun 22 '22 23:06 okdistribute

Would love for MDX the full support to also play nicely with prettier-ignore so I could have an MDX file like this:

---
title: "A Minimal Valid HTML5 Document"
---

import Abbr from "../../components/abbr";
import HtmlTag from"../../components/html-tag";

When writing <Abbr a="HTML" />, keeping the document valid is a good first step towards accessibility. Compared to XHTML, HTML5 validation is surprisingly lenient, requiring only a <HtmlTag t="DOCTYPE" /> and a <HtmlTag t="title" /> element.

{/* prettier-ignore */}
```html
<!DOCTYPE html>
<title>A minimum valid HTML5 document</title>
<p>I’m the content.
```

The document above is valid even though it doesn’t contain an <HtmlTag t="html" />, <HtmlTag t="head" /> or <HtmlTag t="body" /> element, because they’re all considered optional. Also optional is the closing <HtmlTag t="/p" /> tag.

michrome avatar Mar 30 '24 20:03 michrome

MDX is a separate language. It’s definitely based on markdown, but it’s not markdown. To treat MDX as markdown is wrong. It requires its own extension.

The textmate language for MDX is maintained here.

The MDX language server, TypeScript plugin, and VSCode extension are maintained here. It’s based on Volar, the same stack that’s used for the Astro and Vue language servers. If an editor supports Astro or Vue, adding MDX support should be fairly easy.

remcohaszing avatar Jul 16 '24 08:07 remcohaszing

Echoing the desire for MDX support — this is the only thing i still HAVE to open VSCode for and I wish I didn't haha

andersonbcdefg avatar Aug 30 '24 18:08 andersonbcdefg