Replies: 4 comments 8 replies
-
Beta Was this translation helpful? Give feedback.
-
I've created a new docusaurus site that can be found here: https://github.com/mike-solomon/docusaurus-testing/blob/main/website/docs/intro.md?plain=1 In that file, I'm getting this error:
If you remove this whole
Any suggestions on how to handle figures differently? I originally went with Thanks! |
Beta Was this translation helpful? Give feedback.
-
For anyone else who was a bit confused by how to disable these warnings (I originally tried passing it in as a flag rather than an environment variable): If you're building locally you can: DOCUSAURUS_IGNORE_SSG_WARNINGS=true yarn build
# OR
export DOCUSAURUS_IGNORE_SSG_WARNINGS=true
yarn build If you're deploying to GitHub pages: - name: Build website
run: yarn build
env:
DOCUSAURUS_IGNORE_SSG_WARNINGS: true |
Beta Was this translation helpful? Give feedback.
-
I noticed using:
Will produce this warning:
What would be the workaround? I tried removing the (By the way I tried to use Codesandbox but couldn't find a way to share my example, I don't know how to use it, when sharing it shows outdated code) |
Beta Was this translation helpful? Give feedback.
-
Starting with Docusaurus v3.6 and Docusaurus Faster, our new HTML minifier can emit diagnostic errors, that we now log to the console as warnings by default.
These warnings can be a bit verbose/annoying, and we made it possible to disable them with
DOCUSAURUS_IGNORE_SSG_WARNINGS=true
.For now, only our HTML minifier emits those warnings, and its messages aren't always super clear (and it provides an input HTML char number, not a line number)
You can ignore these warnings, and your site will probably keep working just fine, even if it contains invalid HTML markup. But it's preferable to ensure your site has a valid HTML markup.
This issue is to help you troubleshoot these issues.
How to troubleshoot
Most of the time, the errors are related to invalid HTML markup such as:
<li>
element inside<p>
<a>
inside<a>
<p>
inside<p>
These issues can often happen due to how MDX compiles your Markdown to JSX, in particular when using JSX inside your MDX documents. A regular Markdown file with no JSX tag shouldn't have any problem. Note that any other React component on your site can produce invalid markup.
The best is to pass your content to the MDX Playground to see how it compiles it.
You can also remove parts of your MDX documents (or React components) until the warning disappears to find the problematic part.
Example 1
This might surprise you but the following will produce invalid HTML:
This gets compiled by MDX as:
As you can see, there's a duplicate
<p>
tag, which is invalid HTML!The solution in this case is:
or
Example 2
Similarly, with GitHub Flavored Markdown and auto-linking of URLs and emails, the following will lead to invalid HTML:
MDX will compile it as:
As you can see, there are duplicate
<a>
tags, , which is invalid HTML!The solution in this case is:
https://example.com
or
Let us help you
We created this issue to help you troubleshoot these warnings.
But you have to let us help you!
We won't be able to help if you only share a raw error message.
We kindly ask you to share a minimal repro created with https://docusaurus.new or
yarn create docusaurus
. Support requests not providing enough information will be ignored.Before doing so, please apply the method above: use the MDX playground and remove content until the warning disappears to identify the location.
Beta Was this translation helpful? Give feedback.
All reactions