Skip to content

Parser confusion with nested emphasis suffixed with starΒ #15

@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

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions