Closed ericlewis closed 2 years ago
it appears that it should be possible, but the AttributedText framework will need to be updated / expose the functionality to MarkdownUI.
Doesn't this do the job? https://developer.apple.com/documentation/swiftui/menu/onopenurl(perform:)
@gonzalezreal, I actually just used that with MarkdownUI in the latest version of an app I released, as a way of using links to navigate from one MarkDown page to another within the app. Works great. :)
Though I can understand that @ericlewis would want a way of directing standard http:// links to something other than Safari.
@gonzalezreal, I actually just used that with MarkdownUI in the latest version of an app I released, as a way of using links to navigate from one MarkDown page to another within the app. Works great. :)
Though I can understand that @ericlewis would want a way of directing standard http:// links to something other than Safari.
Yeah, this is the use I have as well. The service I'm writing an app for has custom rules for markdown, and when you press a URL that links to something within the service itself, it's supposed to use the to navigate to that content instead of opening Safari.
I have a workaround for this, and it's simply to replace all the appearances of https://thewebsite.com
with websitescheme://
and handle the URL that way.
Yeah, quite aware of the workaround here. Though very undesirable. I am pretty sure I understand at least how to implement this, so it I get the time I shall.
It looks like the onOpenURL
SwiftUI API is not enough to cover this use case. I will think about possible solutions. Any feedback is welcome. Thanks!
Hi @ericlewis, MarkdownUI 1.0.0 now provides custom link handling. You will find a couple of examples in the README and the documentation.
Instead of popping the user out to safari, it would be nice to allow users to be linked into a tool like BetterSafariView