Skip to content

Multiline HTML comments throw a MDX compilation error in canary (3.0.0-alpha.0) #9084

@andrewnicols

Description

@andrewnicols

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn 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

The following HTML comments are fine:

<!-- Single line comment -->
<!-- Multi
line comment
-->

However, a multi-line comment which does not start on the opening line leads to an error:

<!--
Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
-->

And the error:

Error: MDX compilation failed for file "/Users/nicols/git/moodlehq/devdocs/general/releases/2.3.md"
Cause: chunks[startIndex].slice is not a function
Details:
{}

Reproducible demo

No response

Steps to reproduce

Create an mdx file with:

<!--
Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
-->

Expected behavior

HTML comment not shown

Actual behavior

An error in the yarn console:

Error: MDX compilation failed for file "/Users/nicols/git/moodlehq/devdocs/general/releases/2.3.md"
Cause: chunks[startIndex].slice is not a function
Details:
{}

Your environment

3.0 branch is at andrewnicols/devdocs@docusaurus3

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondomain: markdownRelated to Markdown parsing or syntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions