Single Newline Before URLs Not Resulting in Correct Link Rendering
csondi10 opened this issue · comments
Environment
flutter_markdown
package version: 0.6.18- Dart SDK version: 3.1.5
- Flutter version: 3.13.9
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
- 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
- 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/. - 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
-
Expected Behavior (Correctly rendered as links):
- Markdown Live Preview
- GitHub also renders URLs as hyperlinks when preceded by a single newline.
-
Actual Behavior (URL not rendered as a link):
- Observed incorrect behavior on the
markdown
package's live example: dart-lang.github.io/markdown.
- Observed incorrect behavior on the
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.