Skip to main content

Smart Links in nvUltra

Completed

Comments

4 comments

  • carlos

    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
  • Fletcher Penney

    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
  • carlos

    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
  • Fletcher Penney

    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.

Powered by Zendesk