lepture/mistune

Inconsistent AST for autolinks vs manual links

IRDonch opened this issue · 1 comments

>>> from pprint import pprint
>>> import mistune
>>> md = mistune.create_markdown(renderer=mistune.AstRenderer())
>>> pprint(md('[https://example.com](https://example.com)'))
[{'children': [{'children': [{'text': 'https://example.com', 'type': 'text'}],
                'link': 'https://example.com',
                'title': None,
                'type': 'link'}],
  'type': 'paragraph'}]
>>> pprint(md('<https://example.com>'))
[{'children': [{'children': 'https://example.com',
                'link': 'https://example.com',
                'title': None,
                'type': 'link'}],
  'type': 'paragraph'}]

The Markdown sources are equivalent, yet the ASTs are different. The AST for the autolink seems wrong, since I would expect children to always contain a list of child nodes, not text.

Fixed