-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Subject of the issue
When I try to put an escaped HTML entity in a code block within a table, it throws an error. I ran across this when using Docusaurus and needed to use the pipe character in a code block in a table. When I try to use an escaped HTML entity in a code block in a table cell (i.e. <code>test with HTML and entities & |</code>) in the playground, it throws the error TypeError: e.trim is not a function.
Your environment
- OS: Windows 10.0.18362
- Packages: MDX 1.6.16, MDX React 1.6.16, Docusaurus v2.0.0-alpha61
- Env: Node 12.18.2, NPM 6.14.5, Yarn 1.22.4
Steps to reproduce
For Docusaurus, I made an example gist with the config and markdown to use: https://gist.github.com/akrantz01/05a917f9dea75fb73d9991beddc58c84. (I had initially raised this issue in facebook/docusaurus#3246).
In the playground, trying to render/parse the following causes an error:
| Number | Test | Expected |
|-|-|-|
| 1 | `&` | Preformatted text w/o rendered entity |
| 2 | <code>&</code> | Preformatted text w/ rendered entity |
| 3 | `test with backticks` | Preformatted text |
| 4 | `test with backticks and entities & |` | Preformatted text w/o rendering the entity |
| 5 | <code>test with HTML</code> | Preformatted text |
| 6 | <code>test with HTML and entities & |</code> | Preformatted text w/ rendering the entity |
However, if you remove the last line, it displays with no errors.
Expected behaviour
I expect for it to render the entire table with each of the HTML entities replaced as necessary.
Actual behaviour
The parser throws an error and it does not get displayed.

