Smart Links in nvUltra
CompletedHi,
I'm trying to understand how nvUltra works with smart links, or more generally, how it deals with URLs/email addresses. I would prefer both to be clickable without additional formatting (e.g. <> in markdown), but I also want this to be persistent if at all possible. The manual says
"“Smart Links” work at the time you are typing, adding attributes to the rich text. This does not persist when you re-open a plain text file."
Ok, so what behaviour should I expect in nvUltra if I enable this? I've tried it, and it definitely does not make email addresses or urls 'clickable'.
There's a second preference called "Make URL Clickable". Clear enough! but (1) this doesn't work for me in v70, and (2) how does this interact with the "Smart Links" setting, which should do something similar?
I appreciate your feedback.
-
Ok, so there's a previous discussion (https://multimarkdown.zendesk.com/hc/en-us/community/posts/360033507353-Make-URL-s-clickable-working- ) in the forums that is pretty relevant. I agree with many of the commenters on that thread that the "Make URLs clickable" is quite confusing if they are only clickable if wrapped in <> as in Markdown.
0 -
I refactored some of the syntax highlighting code.
For whatever reason, Apple handles URL detection (Smart Links) and other Data Detectors (e.g. phone numbers) differently. From my testing:
1. Smart Links are only detected as they are typed. Pasting them in does not result in a clickable link. Phone numbers *are* detected when pasted. This is true in nvUltra and in TextEdit (my default test comparison to determine what is *normal* macOS behavior for NSTextView's).
2. This means that when opening an existing document, phone numbers will be "active", but URLs will not.
3. There seems to be nothing I can do about this (without rewriting Apple's code and replacing it, which I have no intention of doing.)
4. Because of this, Data Detectors seem to be fully compatible with nvUltra's syntax highlighting. Smart Links are not.
If you use Markdown/MultiMarkdown then macOS Smart Link functionality will not be of much use to you. It will only transiently identify URLs and allow clicking on them. Which is fine, because they would not be functional links when the Markdown is converted to HTML or other formats. If, instead, you use Markdown formatted links (which is really easy in nvUltra due to the use of smart pairs since you can quickly wrap links in `<...>`), then the links will be functional in the editor and preview.
If you do not use Markdown/MultiMarkdown then you can disable syntax highlighting in the MultiMarkdown preferences, which will allow Smart Links to work.
0 -
Hi Fletcher,
Thanks for this. Very useful! One suggestion to make what you're saying clearer in the preferences could be to change "Make URLs clickable" (which suggest they will always be) to "Make markdown URLs clickable" or something of the sort, to make clear this will only happen if using `< >`
Now about this:
If, instead, you use Markdown formatted links (which is really easy in nvUltra due to the use of smart pairs since you can quickly wrap links in `<...>`), then the links will be functional in the editor and preview.
This works for me in Mojave but only I put "mailto:" in front of an email address, or "http://" in front of the URL. Is that the expected behavior?
Thanks.
0 -
carlos -- Correct. `<foo.com>` is not a URL. It could be a web site (`http://foo.com/`), or an ftp site (`ftp://foo.com/`), etc. You need to specify a protocol to be able to do anything useful with it.
0
Please sign in to leave a comment.
Comments
4 comments