Skip to content

Block starting with HTML tag interpreted as one JSX component #611

@danburzo

Description

@danburzo

Subject of the issue

I stumbled opon this bug recently: A block starting with a HTML tag, like in the example below, is interpreted as one JSX component.

<sup>1</sup> A footnote

Output from ASTExplorer (using mdxhast-0.20.2):

{
  "type": "root",
  "children": [
    {
      "type": "jsx",
      "value": "<sup>1</sup> A footnote",
      "position": {
        "start": {
          "line": 1,
          "column": 1,
          "offset": 0
        },
        "end": {
          "line": 1,
          "column": 24,
          "offset": 23
        },
        "indent": []
      }
    }
  ],
  "position": {
    "start": {
      "line": 1,
      "column": 1,
      "offset": 0
    },
    "end": {
      "line": 1,
      "column": 24,
      "offset": 23
    }
  }
}

Your environment

macOS Mojave. npm ls | grep "mdx":

├─┬ @mdx-js/loader@1.0.21
│ ├─┬ @mdx-js/mdx@1.0.21
│ │ ├─┬ remark-mdx@1.0.21
│ ├── @mdx-js/react@1.0.21
├── @next/mdx@8.1.0

Expected behaviour

A JSX element for the <sup> tag, followed by plain text.

Actual behaviour

Text becomes part of the JSX element.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions