SidOfc / mkdx

A vim plugin that adds some nice extra's for working with markdown documents
https://www.vim.org/scripts/script.php?script_id=5620
MIT License
482 stars 13 forks source link

mkdxLink highlight group improvments #166

Closed lyndhurst closed 2 years ago

lyndhurst commented 2 years ago

Hi,

I was wondering if it could be possible to include two edge cases in the mkdxLink highlight group.

  1. In the case of url links with an "anchor" included, the highlight group stops at the # anchor symbol Example: https://www.blog.com/post#section
  2. Sometimes it is just easier to omit the https:// altogether Example: www.google.com

I hope it is not too much trouble, thank you for your time.

SidOfc commented 2 years ago

Hi @lyndhurst, I might be able to add URL fragment support and expand mkdxLink a bit to support more links that GitHub also recognizes when typing markdown. It won't allow you to simply "omit" https:// though. It would still need to be prefixed with at least www. then for example (this is what GitHub supports).

Users will also not really be able to type mail.google.com and have it show up as a link since that would introduce way to many false-positives in the scanning process :)

lyndhurst commented 2 years ago

Nice, thank you. The fragment link case was the main reason I opened the issue, the second case was just a thought. :+1:

SidOfc commented 2 years ago

Should be good now, managed to make it quite a bit more flexible so it handles common prefixes like ww1.somewhere.com:

image

For reference, this is how each of these links is parsed by GH:

lyndhurst commented 2 years ago

Thank you for being so reactive (as always!), I will only be able to check it tomorrow or later tonight though. The extra parsing reference are a nice piece of info too, cheers :+1:

SidOfc commented 2 years ago

I do my best, thank you for the appreciation! And by all means, if the issue is not fixed, please do reopen or request for me to reopen if you can't 👍