-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docusaurus] {=mdx}
code block seems broken (Quarto 1.4 with Docusaurus v3)
#8333
Comments
{=mdx}
code block seems broken{=mdx}
code block seems broken (Quarto 1.4)
This I believe this happened before the change to I don't have much context but looking at the docusaurus doc, it seems to be interesting syntax related to mdx support in some situation with specific tools, according to doc at https://docusaurus.io/docs/i18n/crowdin#mdx Does the use of code block Doc says it should be
it was also mentioned in V1 to V2 migration guide : https://docusaurus.io/docs/migration/v2/translated-sites So it does not seem necessary indeed but seems useful to protect the output for some situations @jjallaire do you remember about b761219 and using function RawBlock(el)
if el.format == 'mdx' then
return pandoc.CodeBlock(el.text, pandoc.Attr("", {"mdx-code-block"})) Was it necessary for some specific reason ? or dependant of docusaurus version ? |
In Docusaurus v3.0.1, which I tried, the |
Thanks for the link to the documentation. This seems to be supported by Docusaurus 3.1.0, so maybe it's a bug of Docusaurus... |
I understand the Docusaurus V3 is a big change, especially about MDX V1 to V3 : https://docusaurus.io/docs/migration/v3#upgrading-mdx I am not sure exactly which version we support but I would say it is Docusaurus V2 because v3 is out since 31 October 2023 so not that long. So I would not surprise to find issues. @cscheid did we do specific work for Docusaurus V3 and upgrade to MDX v1 to v3 ? I am not sure and we probably need to check what Quarto is producing and adapt. |
I can confirm on my project (Quarto 1.4.545 and Docusaurus 3.1.0 on MacOS Ventura) that removing the additional space after ``` immediately fixes the rendering. Hope this gets fixed soon. @cderv |
Or, should it be modified to ignore the space before the infostring on the Docusaurus side (mdx side)? |
This seems to be handled with a simple regular expression. It might be easy to update it to ignore spaces. |
{=mdx}
code block seems broken (Quarto 1.4){=mdx}
code block seems broken (Quarto 1.4 with Docusaurus v3)
Thanks for finding this. It seems they could indeed add support for space in their regex. I believe this is common and they support it for other codeblocks. On our side, the space is added by Pandoc directly, as this is the Markdown syntax created from Lua > pandoc -f native -t markdown_strict+fenced_code_blocks+backtick_code_blocks
CodeBlock ("",["mdx-code-block"],[]) "content"
``` mdx-code-block
content
``` It could also be seen as an improvement on Pandoc's side because they do not document with space in their doc (https://pandoc.org/MANUAL.html#fenced-code-blocks) but they do consider space as the created syntax if I try round-trip
From their doc:
To fix this in Pandoc we would need to create ourself raw markdown instead of a CodeBlock at quarto-cli/src/resources/extensions/quarto/docusaurus/docusaurus.lua Lines 52 to 56 in 9e35ab3
|
Thanks. IIUC, this is a bug that occurred between Docusaurus v2 and v3 and can convince them to ignore the space. Until tomorrow I don't have time to do any more research or report or PR to the docusaurus repo, but I'll take a look at this on Saturday if someone doesn't. |
I opened a PR with a change that should fix this - But this indeed maybe on docusaurus itself to have broader support. |
FYI, the issue of Docusaurus has been fixed by facebook/docusaurus#9776 |
Bug description
If we use mdx in mdx files, it doesn't seem necessary to write it as code blocks.``` mdx-code-block
should be changed to```mdx-code-block
Steps to reproduce
Expected behavior
Actual behavior
Your environment
Quarto check output
The text was updated successfully, but these errors were encountered: