MarkdownView icon indicating copy to clipboard operation
MarkdownView copied to clipboard

Detect raw URLs

Open Strider-Alex opened this issue 2 years ago • 3 comments

The feature you want to get in MarkdownView Detect raw URLs and make them clickable.

Describe that feature in detail Currently raw URLs (e.g. https://google.com) are not clickable in MarkdownView. I believe this feature is supported in https://github.com/gonzalezreal/swift-markdown-ui, but not this repo. It would be nice to support that.

Strider-Alex avatar Jul 03 '23 03:07 Strider-Alex

Spent some time discovering this issue. I think your request is to add support for extended version of auto-link.

I put some breakpoints in gonzalezreal's work to find out how his package works. As a result, the cmark-gfw he used in the package natively support this behavior.

Unfortunately, my package is based on swift-markdown which relies on swift-cmark. Seems like it doesn't support this extended behavior.

It may possible to implement some extra logic to extract URLs from text, but it's big work and may become buggy.

I will open an issue to see if swift-markdown will support this extended behavior.

You can check out this test webpage. The official CommonMark does not include this syntax.

The good news is <https://google.com> works.

LiYanan2004 avatar Jul 03 '23 05:07 LiYanan2004

Opened an issue: https://github.com/apple/swift-markdown/issues/134

If that becomes available, MarkdownView will support it immediately.

LiYanan2004 avatar Jul 03 '23 07:07 LiYanan2004

By far, it's still works as I promised:

Thanks to apple/swift-markdown, it can fully compliant with the CommonMark Spec.

In gonzalezreal's package, he says:

... It is compatible with the GitHub Flavored Markdown Spec ...

Just Okay 🤣

LiYanan2004 avatar Jul 03 '23 07:07 LiYanan2004