Skip to content

Parser confusion with nested emphasis suffixed with star #15

Open
@ChristianMurphy

Description

@ChristianMurphy

Subject of the issue

***a*a*a* a*

is parsed as

{
    "type": "root",
    "children": [
        {
            "type": "paragraph",
            "children": [
                {
                    "type": "text"
                },
                {
                    "type": "emphasis",
                    "children": [
                        {
                            "type": "emphasis",
                            "children": [
                                {
                                    "type": "text"
                                }
                            ]
                        },
                        {
                            "type": "text"
                        },
                        {
                            "type": "emphasis",
                            "children": [
                                {
                                    "type": "text"
                                }
                            ]
                        },
                        {
                            "type": "text"
                        }
                    ]
                }
            ]
        }
    ]
}

while in CommonMark it parses as

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
  <paragraph>
    <emph>
      <emph>
        <emph>
          <text>a</text>
        </emph>
        <text>a</text>
      </emph>
      <text>a</text>
    </emph>
    <text> a</text>
    <text>*</text>
  </paragraph>
</document>

Not the difference in the depth of emphasis two vs three.

Your environment

  • OS: Ubuntu
  • Packages: mdast-util-from-markdown 0.8.5
  • Env: node v15.5.1

Steps to reproduce

const parse = require("mdast-util-from-markdown");

parse("***a*a*a* a*")

Expected behavior

Three levels of emphasis

Actual behavior

Two levels of emphasis

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 type/bugThis is a problem👍 phase/yesPost is accepted and can be worked on🙆 yes/confirmedThis is confirmed and ready to be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions