You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feed generation warns: "Received true for a non-boolean attribute" when using {2,3} highlighting #6195
I have read the console error message carefully (if applicable).
Description
the new version is 2.0.0-beta.14
```jsx {2,3}
const a = 123;
return {
a: 1
}
```
Warning: Received `true` for a non-boolean attribute `{2,3}`.
If you want to write it to the DOM, pass a string instead: {2,3}="true" or {2,3}={value.toString()}.
at code
at D:\github\website\node_modules\@mdx-js\react\dist\cjs.js:153:30
Steps to reproduce
when use highlight code,eg: {2, 3}
npm run build,throw warning
Expected behavior
No warning show
Actual behavior
Warning: Received true for a non-boolean attribute {2,3}.
Your environment
Public source code:
Public site URL:
Docusaurus version used:
Environment name and version (e.g. Chrome 89, Node.js 16.4):
Operating system and version (e.g. Ubuntu 20.04.2 LTS):
changed the title [-]when run build cause warn [/-][+]Using {2,3} for highlight causes warning: Received `true` for a non-boolean attribute[/+]on Dec 25, 2021
I do remember seeing the warning some time back in our production builds, but at some point they are gone. Could you delete node_modules and lock file, re-install, run clear, and build to see if the issue persists?
In the "Deploy to GitHub Pages" step, the build emits warning.
I know what's the issue: this is thrown from @mdx-js/runtime, and is only visible when you have line highlights in the blog. This is because the blog feeds do not go through the MDXComponentProvider and therefore these markups end up in the final React output. I think we should just recommend using comments for highlighting for a multitude of reasons.
I get something similar, where I have a custom remark plugin preprocessing my code snippets to feed them to a testing framework. Some code blocks have an skip-testing annotation like:
@dsmmcken This basically happens with any codeblock meta that's not foo="bar". It's a really common pattern, but if there's no remark plugin to consume it, it ends up in the final MDX output, which is the case for our blog feeds feature, which uses mdx/runtime
changed the title [-]Using {2,3} for highlight causes warning: Received `true` for a non-boolean attribute[/-][+]Feed generation warns: "Received `true` for a non-boolean attribute" when using {2,3} highlighting[/+]on Jan 8, 2022
Activity
[-]when run build cause warn [/-][+]Using {2,3} for highlight causes warning: Received `true` for a non-boolean attribute[/+]Josh-Cena commentedon Dec 26, 2021
I do remember seeing the warning some time back in our production builds, but at some point they are gone. Could you delete node_modules and lock file, re-install, run
clear, and build to see if the issue persists?slorber commentedon Dec 27, 2021
😅 never seen this warning before, weird
Josh-Cena commentedon Dec 28, 2021
Just realized I saw it not on the Docusaurus site build, but on my site...
https://app.circleci.com/pipelines/github/Josh-Cena/Josh-Cena.github.io/30/workflows/b0668fe3-97ae-4ef1-8e8d-1f431c3cbda8/jobs/28
In the "Deploy to GitHub Pages" step, the build emits warning.
I know what's the issue: this is thrown from
@mdx-js/runtime, and is only visible when you have line highlights in the blog. This is because the blog feeds do not go through theMDXComponentProviderand therefore these markups end up in the final React output. I think we should just recommend using comments for highlighting for a multitude of reasons.slorber commentedon Dec 28, 2021
Oh I see
Agree, I don't like too much the
{2,3}notation, trying to emphasis the start/end comments moredsmmcken commentedon Jan 7, 2022
I get something similar, where I have a custom remark plugin preprocessing my code snippets to feed them to a testing framework. Some code blocks have an skip-testing annotation like:
and this warns with a similar error.
Josh-Cena commentedon Jan 7, 2022
@dsmmcken This basically happens with any codeblock meta that's not
foo="bar". It's a really common pattern, but if there's no remark plugin to consume it, it ends up in the final MDX output, which is the case for our blog feeds feature, which usesmdx/runtime[-]Using {2,3} for highlight causes warning: Received `true` for a non-boolean attribute[/-][+]Feed generation warns: "Received `true` for a non-boolean attribute" when using {2,3} highlighting[/+]