Skip to content

mdx-code-block doesn't work when indented #10220

@SilianZ

Description

@SilianZ

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

I'm using Crowdin to translate my Docaurus MDX documents. In order to make the text displayed correctly on Crowdin, I added mdx-code-block to my document according to the official document to convert the text into a code block.

According to my research on some official documents, this is probably because I didn't install @docausaurus/utils, but the document does not clearly state that I need to install this package. If possible, please improve the content of this part of the document.

Here is my source code:

    ```mdx-code-block
    <Tabs>
    <TabItem value="c1" label="下载 Release" default>
    ```

    1.[Releases](https://github.com/TTB-Network/python-openbmclapi/releases) 中下载代码。

    2. 将下载好的源码放到一个事先准备的文件夹。

    3. 在文件夹中打开终端。

    ```mdx-code-block
    </TabItem>
    <TabItem value="c2" label="使用 Git 克隆">
    ```

    1. 克隆仓库:

        ```sh
        git clone https://github.com/TTB-Network/python-openbmclapi.git
        ```

        :::tip

        你亦可以使用镜像源加速:

        ```sh
        git clone https://ghproxy.bugungu.top/https://github.com/TTB-Network/python-openbmclapi.git
        ```

        :::

    2. 打开仓库所在文件夹:

        ```sh
        cd python-openbmclapi
        ```

    ```mdx-code-block
    <Asciinema
    url="https://asciinema.org/a/655199.cast"
    options={{
        theme: "monokai",
        poster: "npt:21.5",
        cols: 100,
        rows: 30,
        idleTimeLimit: 0.2,
    }}
    />

    </TabItem>
    </Tabs>

    ```

Reproducible demo

No response

Steps to reproduce

  1. Create MDX files through source code.
  2. Start the site.

Expected behavior

According to the description of the document, the content of the mdx-code-block code block will be automatically recognized as JSX content.

Actual behavior

However…

image

Your environment

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondomain: markdownRelated to Markdown parsing or syntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions