docusaurus: Can't use math expressions using '|' in Markdown tables (remark-math/KaTeX/GFM)
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn 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
| $1$ | $2$ |
| --------- | --------- |
| $|3| = 3$ | $|4| = 4$ |
will be rendered like:
The ‘|’ inside the latex expression is mistaken for a separator for the sheet.
Reproducible demo
No response
Steps to reproduce
write
| $1$ | $2$ |
| --------- | --------- |
| $|3| = 3$ | $|4| = 4$ |
inside a doc.
Expected behavior
The ‘|’ in the latex expression is processed correctly.
Actual behavior
The ‘|’ in the latex expression is mistaken for a separator for the sheet.
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used:latest
- Environment name and version (e.g. Chrome 89, Node.js 16.4):Microsoft Edge, Node.js 18.12.1
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):Windows 11
Self-service
- I’d be willing to fix this bug myself.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 17 (2 by maintainers)
Hey
This is already fixed for Docusaurus v3 with MDX v2. You’ll have to escape the pipes with
\|
in math expressions.I’m not sure there’s a good way to do that under Docusaurus v2 (MDX v1). My suggestion would be to wait for Docusaurus v3, it should move to beta very soon.