-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
context
When I parse markdown:
new _li**ne**_
a
expectation
I expected to get output:
<root>
<paragraph>
<text>
new
<em>
<text>
li
<strong>
<text>
ne
<hardbreak>
<text>
a
bug
But instead I get:
<root>
<paragraph>
<text>
new
<em>
<text>
li
<strong>
<text>
ne
<text>
<hardbreak>
<text>
a
There's an additional <text> empty node being inserted at the end. Problem seems to occur when there are nested styles and both end at the same time.
Reproduce the bug
Code:
from markdown_it import MarkdownIt
from markdown_it.tree import SyntaxTreeNode
md = MarkdownIt('gfm-like').disable(['linkify'])
text = ("""
new _li**ne**_
new _l**i**ne_
new _**line**_
""")
tokens = md.parse(text)
node = SyntaxTreeNode(tokens)
print("------\n" + node.pretty(indent=2, show_text=True) + "------\n")output:
------
<root>
<paragraph>
<inline>
<text>
new
<em>
<text>
li
<strong>
<text>
ne
<text>
<hardbreak>
<text>
new
<em>
<text>
l
<strong>
<text>
i
<text>
ne
<hardbreak>
<text>
new
<em>
<text>
<strong>
<text>
line
<text>------
List your environment
Version of markdown-it-py - 4.0.0
Versions of mdit-py-plugins - none
The version of Python you're using. - 3.10.6
Your operating system - Ubuntu 20.04.6 LTS
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working