Closed FoxxMD closed 1 month ago
cc @wooorm, looks like a bug in remark-directive?
This parses fine:
<div>
<span>
:::container
content
:::
</span>
</div>
But this does not due to the indentation:
<div>
<span>
:::container
content
:::
</span>
</div>
Unfortunately Prettier MDX does not like the first form.
Surprisingly, these 2 parses fine, and it looks the problem is only on double-nested elements?
<div>
:::container
content
:::
</div>
<div>
:::container
content
:::
</div>
But it fails with 4-space indentation:
<div>
:::container
content
:::
</div>
Note that remark-directives tests do not seem to cover these edge cases:
https://github.com/remarkjs/remark-directive/blob/main/test/fixtures/container/input.md
Smallest reproduction:
<div>
:::x
Lipsum.
:::
</div>
5:1-5:7: Expected the closing tag `</div>` either after the end of `directiveContainer` (6:1) or another opening tag after the start of `directiveContainer` (2:5)
<div>
:::x
Lipsum.
- :::
+ :::
</div>
Passes.
Similar bugs have happened before. Normally markdown is sensitive to indent. Here is still has to be, but differently.
released
Can confirm micromark-extension-directive@3.0.1 fixes the issue in my project :) Thanks for the quick response!
Thanks @wooorm 😄
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Using a markdown admonition (
:::tip my content :::
) inside<TabItem>
in an MDX file causes project compilation to fail due toExpected the closing tag </TabItem> either after the end of directiveContainer (22:1) or another opening tag after the start of directiveContainer (12:9)
Reproducible demo
https://codesandbox.io/p/sandbox/dawn-violet-jns443
Steps to reproduce
docs/test.mdx
<TabItem>
Expected behavior
For the page to render.
The page does render if instead of using markdown I use MDX for the admonition IE
<Admonition type="tip">...
but I should be able to use markdown inside of MDX components.Actual behavior
Page compilation fails.
Your environment
Self-service