Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser confusion with nested emphasis suffixed with star #15

Open
ChristianMurphy opened this issue Feb 5, 2021 · 2 comments
Open

Parser confusion with nested emphasis suffixed with star #15

ChristianMurphy opened this issue Feb 5, 2021 · 2 comments
Labels
👍 phase/yes Post is accepted and can be worked on 🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on

Comments

@ChristianMurphy
Copy link
Member

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

@ChristianMurphy ChristianMurphy added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Feb 5, 2021
@ChristianMurphy ChristianMurphy changed the title Parser confusion with nested emphasis prefixed with stars Parser confusion with nested emphasis suffixed with star Feb 5, 2021
@wooorm wooorm added 👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on labels Aug 21, 2021
@github-actions
Copy link

Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.

Is this something you can and want to work on?

Team: please use the area/* (to describe the scope of the change), platform/* (if this is related to a specific one), and semver/* and type/* labels to annotate this. If this is first-timers friendly, add good first issue and if this could use help, add help wanted.

@wooorm wooorm removed the 🙉 open/needs-info This needs some more info label Aug 21, 2021
@wooorm
Copy link
Member

wooorm commented Sep 24, 2021

Another same/similar example: unifiedjs/unified#160 (reply in thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 phase/yes Post is accepted and can be worked on 🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on
Development

No branches or pull requests

2 participants