facebook / facebook/docusaurus

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

Đang mở
#9,092 15 bình luận 0 reaction 0 người được giao Xem trên GitHub
domain: markdown proposal
Ngôn ngữ chính
TypeScript
Star
66.2k
Fork
10k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
52

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.