dart-lang / markdown

A Dart markdown library
https://pub.dev/packages/markdown
BSD 3-Clause "New" or "Revised" License
455 stars 200 forks source link

Single Newline Before URLs Not Resulting in Correct Link Rendering #564

Open csondi10 opened 1 year ago

csondi10 commented 1 year ago

Environment

Description

The flutter_markdown package, which relies on the markdown package for rendering Markdown content, is not recognizing URLs as links when they are preceded by a single newline. This issue appears to be stemming from the markdown package itself, as the same behavior is observed when Markdown content is rendered on the Dart package's live example site.

Expected Behavior

A URL that follows a single newline should be automatically recognized and rendered as a hyperlink.

Actual Behavior

When there is a single newline before a URL, it is not being rendered as a hyperlink.

Steps to Reproduce

  1. Provide the following Markdown content to be parsed and rendered by the markdown package:

    Here is a link, displayed correctly: https://example.com
    Here is a link, displayed wrong:
    https://example.com
    
    Here is another link after an empty line:
    
    https://example.com
  2. View the rendering result either within a flutter_markdown widget or on the Dart package's live example site at https://dart-lang.github.io/markdown/.
  3. Notice that the second URL (with a single newline before it) is not clickable, while the first and third ones are rendered correctly as a hyperlink.

Expected vs Actual

The inconsistency leads to a worse UX in our app. Of course we could resolve it with workarounds but it would be beneficial for the markdown package to align with the behavior seen on platforms like GitHub and other Markdown previewers.

Thank you for your attention to this matter, and I am looking forward to your response and a resolution.