zed-industries / extensions

Extensions for the Zed editor
562 stars 224 forks source link

MDX #203

Open okdistribute opened 2 years ago

okdistribute commented 2 years ago

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!

JosephTLyons commented 2 years ago

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.

okdistribute commented 2 years ago

Works for me! Thanks

michrome commented 3 months ago

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 , or element, because they’re all considered optional. Also optional is the closing tag.