facebook / facebook/docusaurus

When using commonmark, `<var>` inside of `<code>` results in a codeblock

Open
#10,533 10 comments 1 reaction 0 assignees View on GitHub
bug domain: markdown
Dominant language
TypeScript
Stars
66.2k
Forks
10k
Avg merge
1d 3h
Merged PRs (30d)
52

Description

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Prerequisites

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

### Description

[Heres the rerpo of the issue](https://codesandbox.io/p/devbox/gifted-wind-qdeo7?privacy=public) - you can see the demo
[here](https://pkgqkm-3000.csb.app/docs/intro)

This is the problem code:

```
# intro.md:

This is inline var

```

Results in

![image](https://github.com/user-attachments/assets/fcd285a9-8599-489c-a4a7-0a8bdee88328)

However, it should not result in a code block, instead it should still be inline.

Note that if you remove commonmark support by editing `docusaurus.config.ts` to not have:

```
markdown: {
format: 'detect',
},
```

Then it works with inlining.

I know commonmark support is experimental, and I am not expecting a quick fix. I am merely hoping my issue report will help improve support for commonmark when it does work. Thanks a ton for all of your work on this project :)

### Self-service

- [X] I'd be willing to fix this bug myself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.