facebook / facebook/docusaurus

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

オープン
#9,092 コメント 15 件 リアクション 0 件 担当者 0 名 GitHub で見る
domain: markdown proposal
主要言語
TypeScript
スター
66.2k
フォーク
10k
平均マージ
1日 3時間
マージ済み PR(30日)
52

説明

### 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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。