-
-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Description
I'm seeing an issue where the child text nodes of some link text is being split. For example:
doc = Commonmarker.parse("[@ewd](https://example.com)")
doc.inspect
# "#<Commonmarker::Node(document): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27} children=[#<Commonmarker::Node(paragraph): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27} children=[#<Commonmarker::Node(link): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27}, url=\"https://example.com\", title=\"\" children=[#<Commonmarker::Node(text): source_position={start_line: 1, start_column: 2, end_line: 1, end_column: 3}, string_content=\"@e\">, #<Commonmarker::Node(text): source_position={start_line: 1, start_column: 4, end_line: 1, end_column: 4}, string_content=\"w\">, #<Commonmarker::Node(text): source_position={start_line: 1, start_column: 5, end_line: 1, end_column: 5}, string_content=\"d\">]>]>]>\n"
The link contains 3 children nodes with the text @e
, w
, and d
respectively. However, if I change the content
doc = Commonmarker.parse("[@eaa](https://example.com)")
doc.inspect
# "#<Commonmarker::Node(document): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27} children=[#<Commonmarker::Node(paragraph): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27} children=[#<Commonmarker::Node(link): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27}, url=\"https://example.com\", title=\"\" children=[#<Commonmarker::Node(text): source_position={start_line: 1, start_column: 2, end_line: 1, end_column: 5}, string_content=\"@eaa\">]>]>]>\n"
I get a single child node with the text @eaa
.
If I set autolink
to false
for the first example, I get the expected behaviour:
doc = Commonmarker.parse("[@ewd](https://example.com)", options: { extension: { autolink: false } })
doc.inspect
# "#<Commonmarker::Node(document): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27} children=[#<Commonmarker::Node(paragraph): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27} children=[#<Commonmarker::Node(link): source_position={start_line: 1, start_column: 1, end_line: 1, end_column: 27}, url=\"https://example.com\", title=\"\" children=[#<Commonmarker::Node(text): source_position={start_line: 1, start_column: 2, end_line: 1, end_column: 5}, string_content=\"@ewd\">]>]>]>\n"
A single child text node with the content @ewd
.
Metadata
Metadata
Assignees
Labels
No labels