Skip to content
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

Feed generation warns: "Received true for a non-boolean attribute" when using {2,3} highlighting #6195

Closed
3 of 7 tasks
KELEN opened this issue Dec 25, 2021 · 6 comments · Fixed by #6454
Closed
3 of 7 tasks
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@KELEN
Copy link

KELEN commented Dec 25, 2021

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 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):

Reproducible demo

No response

Self-service

  • I'd be willing to fix this bug myself.
@KELEN KELEN added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Dec 25, 2021
@Josh-Cena Josh-Cena changed the title when run build cause warn Using {2,3} for highlight causes warning: Received true for a non-boolean attribute Dec 25, 2021
@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Dec 25, 2021
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented 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?

@Josh-Cena Josh-Cena added the status: needs more information There is not enough information to take action on the issue. label Dec 26, 2021
@slorber
Copy link
Collaborator

slorber commented Dec 27, 2021

😅 never seen this warning before, weird

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented 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 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.

@Josh-Cena Josh-Cena removed the status: needs more information There is not enough information to take action on the issue. label Dec 28, 2021
@slorber
Copy link
Collaborator

slorber commented Dec 28, 2021

Oh I see

Agree, I don't like too much the {2,3} notation, trying to emphasis the start/end comments more

@dsmmcken
Copy link
Contributor

dsmmcken commented 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:

```python skip-test
# untested example
```

and this warns with a similar error.

@Josh-Cena
Copy link
Collaborator

@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

@Josh-Cena Josh-Cena 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 Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants