vim-markdown icon indicating copy to clipboard operation
vim-markdown copied to clipboard

Regex for <> links and code within lists.

Open sadasant opened this issue 13 years ago • 0 comments

I've been using this line to fix the one line links:

syn region mkdLink matchgroup=mkdDelimiter start="<\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z][-_0-9A-Za-z]*\.\)\{1,50 }\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*\)\@="  end=">" oneline contains=@Spell skipwhite

Also, the syntax gets messy when there's code inside lists, like this:

  • A list. Yep.
Woah code!

So I did this:

syn match  mkdBlockCode  /^\(^\S.*\n\)\@<=\n\(^\(\s\{4}\|\t\).*\n\)\+/
syn match  mkdBlockCode  /^\(^\s\{4}\S.*\n\)\@<=\n\(^\(\s\{8}\|\t\{2}\).*\n\)\+/
syn match  mkdBlockCode  /^\(^\s\{8}\S.*\n\)\@<=\n\(^\(\s\{12}\|\t\{3}\).*\n\)\+/

Which is enough for a 3 depth list, I wonder if there's a workaround for any depth.

sadasant avatar Nov 16 '12 22:11 sadasant