From: Ciro Santilli Date: Mon, 6 Oct 2014 10:05:22 +0000 (+0200) Subject: Merge pull request #121 from cirosantilli/autolink X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/c4282db6cc2c536cc83c8b803b065c4440aecbc2?hp=-c Merge pull request #121 from cirosantilli/autolink Highlight angle braced hyperlinks. --- c4282db6cc2c536cc83c8b803b065c4440aecbc2 diff --combined syntax/mkd.vim index 4811898,4dc8a49..a4c7af4 --- a/syntax/mkd.vim +++ b/syntax/mkd.vim @@@ -2,9 -2,9 +2,7 @@@ " Language: Markdown " Maintainer: Ben Williams " URL: http://plasticboy.com/markdown-vim-mode/ -" Version: 9 -" Last Change: 2009 May 18 " Remark: Uses HTML syntax file - " Remark: I don't do anything with angle brackets (<>) because that would too easily - " easily conflict with HTML syntax " TODO: Handle stuff contained within stuff (e.g. headings within blockquotes) @@@ -49,12 -49,16 +47,16 @@@ syn region mkdFootnotes matchgroup=mkdD syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained oneline syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained oneline syn region mkdLink matchgroup=mkdDelimiter start="\\\@ ]*>\)\@=" end=">" + " Link definitions: [id]: URL (Optional Title) - " TODO handle automatic links without colliding with htmlTag () syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained @@@ -97,14 -101,14 +99,14 @@@ if get(g:, 'vim_markdown_math', 0 syn region mkdMath matchgroup=mkdDelimiter start="\\\@ c + + Execute (autolink): + AssertNotEqual SyntaxOf('a'), 'mkdInlineURL' + AssertEqual SyntaxOf('<'), 'mkdDelimiter' + AssertEqual SyntaxOf('b'), 'mkdInlineURL' + AssertEqual SyntaxOf('>'), 'mkdDelimiter' + AssertNotEqual SyntaxOf('c'), 'mkdInlineURL' + + Given mkd; + + + Execute (autolink with scheme case is insensitive): + AssertEqual SyntaxOf('a'), 'mkdInlineURL' + + Given mkd; + + + Execute (autolink without known scheme is not a link): + AssertNotEqual SyntaxOf('n'), 'mkdInlineURL' + + Given mkd; + + + Execute (autolink without scheme is not a link): + AssertNotEqual SyntaxOf('a'), 'mkdInlineURL' + + Given mkd; + < http://a > + + + + Execute (autolink with space is not a link): + AssertNotEqual SyntaxOf('a'), 'mkdInlineURL' + AssertNotEqual SyntaxOf('b'), 'mkdInlineURL' + AssertNotEqual SyntaxOf('c'), 'mkdInlineURL' + AssertNotEqual SyntaxOf('d'), 'mkdInlineURL' + AssertNotEqual SyntaxOf('e'), 'mkdInlineURL' + + Given mkd; + \ + + Execute (autolinks can be backslash escaped): + AssertNotEqual SyntaxOf('<'), 'mkdDelimiter' + # Math Given mkd;