facebook / facebook/docusaurus

Make most features work in CommonMark mode: head, live code blocks, tabs...

Offen
#9,092 15 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
domain: markdown proposal
Vorherrschende Sprache
TypeScript
Sterne
66.2k
Forks
10k
Ø Merge
1 T. 3 Std.
Gemergte PRs (30 T.)
52

Beschreibung

### Motivation

Related to the CommonMark support issue: https://github.com/facebook/docusaurus/issues/3018

Some custom elements we created do not work when using the CommonMark parser mode, that you can turn on using:
- `frontMatter.mdx.format: 'md'`
- `config.markdown.format: 'detect'` + using the `.md` extension

---

I think it would be convenient for users to have features working fine in both modes in a consistent way. I believe it is possible, but may require some adaptations.

Here are some components that do not currently work:

---

## SEO

This should work in CommonMark too, but currently does not:

```md

HEAD Markdown Page tests title

```

## Summary/details

Renders as:

![CleanShot 2023-06-22 at 17 06 05](https://github.com/facebook/docusaurus/assets/749374/44c64ed8-ca27-4622-adeb-174f59b41247)

Instead of:

![CleanShot 2023-06-22 at 17 07 11](https://github.com/facebook/docusaurus/assets/749374/4503f8da-b8c3-46bd-b484-7110f2600e05)

---

## Live code editor

Renders as:

![CleanShot 2023-06-22 at 17 07 58](https://github.com/facebook/docusaurus/assets/749374/bfac7887-a234-4474-9f3d-67ed7f880c8b)

Instead of:

![CleanShot 2023-06-22 at 17 07 28](https://github.com/facebook/docusaurus/assets/749374/7efc0c56-9d84-4e76-bd9a-3a1c9fede837)

---

## Tabs

Renders as: N/A because we don't have any syntax that does not require using MDX/ESM imports.

Instead of:

![CleanShot 2023-06-22 at 17 08 35](https://github.com/facebook/docusaurus/assets/749374/0997ed59-0f85-48e3-b217-da73ab3d9733)

Possible solution? IMHO this syntax should be allowed without imports:

```md


This is an apple 🍎


This is an orange 🍊


This is a banana 🍌

```

### Structured data

As part of https://github.com/facebook/docusaurus/pull/9669 we are adding a `@theme/StructuredData` helper component:

```mdx
import StructuredData from "@theme/StructuredData";




# Title
```

We should figure out how to define structured data in CommonMark mode

### Self-service

- [X] I'd be willing to do some initial work on this proposal myself.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.