Skip to content

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

Closed

Description

@KELEN

Have you read the Contributing Guidelines on issues?

Prerequisites

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.

Activity

  1. added
    bug
    status: needs triage
    on Dec 25, 2021
  2. 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
  3. removed
    status: needs triage
    on Dec 25, 2021
  4. Josh-Cena commented on Dec 26, 2021

    @Josh-Cena
    Collaborator

    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?

  5. added
    status: needs more information
    on Dec 26, 2021
  6. slorber commented on Dec 27, 2021

    @slorber
    Collaborator

    😅 never seen this warning before, weird

  7. Josh-Cena commented on Dec 28, 2021

    @Josh-Cena
    Collaborator

    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.

  8. removed
    status: needs more information
    on Dec 28, 2021
  9. slorber commented on Dec 28, 2021

    @slorber
    Collaborator

    Oh I see

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

  10. dsmmcken commented on Jan 7, 2022

    @dsmmcken
    Contributor

    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.

  11. Josh-Cena commented on Jan 7, 2022

    @Josh-Cena
    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

  12. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions