Mdx: Unexpected HTML output in aside > details > ul

Created on 26 Oct 2020  路  3Comments  路  Source: mdx-js/mdx

Subject of the issue

I don't think the output for this MDX this is correct:

<aside>
  foo bar baz

  <details>
    <summary>foo bar baz</summary>

    In no particular order

    - foo
    - bar
    - baz

  </details>
</aside>

Outputs:

<aside>
  foo bar baz
  <details open="">
    <summary>foo bar baz</summary>
    <pre>
      <code>
        In no particular order

        - foo
        - bar
        - baz
      </code>
    </pre>
  </details>
</aside>

Your environment

  • OS: Ubuntu 20.04
  • Packages: "@mdx-js/mdx": "^1.6.19", "@mdx-js/react": "^1.6.19", "gatsby-plugin-mdx": "^1.2.25", and "@mdx-js/runtime": "1.6.19" in the codesandbox below
  • Env: Node 12.6, yarn 1.21.1

Steps to reproduce

https://codesandbox.io/s/mdx-forked-tls88?file=/src/App.js

Expected behaviour

It should output <ul> and multiple <li>

<aside>
  foo bar baz
  <details open="">
    <summary>foo bar baz</summary>

    In no particular order

    <ul>
      <li>foo</li>
      <li>bar</li>
      <li>baz</li>
    </ul>
  </details>
</aside>

I ran the expected output through https://validator.w3.org/#validate_by_input and it passed, so I'm not sure why I'm getting the unexpected output.

Actual behaviour

It should not output <pre> and <code> in this example.

馃檵 typquestion

All 3 comments

This works as expected, indent in markdown creates a codeblock.

not adding the indent

<aside>
foo bar baz
<details>
<summary>foo bar baz</summary>

In no particular order

- foo
- bar
- baz

</details>
</aside>

creates the output expected.

If you want to disable indented codeblocks, see https://github.com/mdx-js/mdx/issues/993

To add: on the next branch of MDX, code blocks are removed, so that you can indent however you like. But, that also results in weirdness for users, because they expect MDX to work like markdown. So I鈥檓 not too sure about that.

Thanks @ChristianMurphy, I guess I just never came across this use case before using MDX.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johno picture johno  路  3Comments

codebender828 picture codebender828  路  4Comments

waterfoul picture waterfoul  路  3Comments

egoist picture egoist  路  5Comments

trevordmiller picture trevordmiller  路  3Comments