Skip to content

Commit 181add4

Browse files
committed
Fix automatic links by restricting characters in mail links.
Previously, pandocAutomaticLink captures too much in the e-mail side. For example, the following is captured as a single e-mail link: <div>Here is a sentence with a @citation. Here is another sentence.</div> The presence of the @ and . in between any < and >, regardless of other content will result in a match. What's needed is to restrict e-mail addresses to a certain range of characters, not including the space character. (See https://en.wikipedia.org/wiki/Email_address#Syntax.) This patch fixes this.
1 parent eaf2507 commit 181add4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

syntax/pandoc.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ syn match pandocReferenceDefinitionAddress /:\s*\zs.*/ contained containedin=pan
264264
syn match pandocReferenceDefinitionTip /\s*".\{-}"/ contained containedin=pandocReferenceDefinition,pandocReferenceDefinitionAddress contains=@Spell
265265
"}}}
266266
" Automatic_links: {{{3
267-
syn match pandocAutomaticLink /<\(https\{0,1}.\{-}\|.\{-}@.\{-}\..\{-}\)>/ contains=NONE
267+
syn match pandocAutomaticLink /<\(https\{0,1}.\{-}\|[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~.]\{-}@[A-Za-z0-9\-]\{-}\.\w\{-}\)>/ contains=NONE
268268
" }}}
269269
"}}}
270270
" Citations: {{{2

0 commit comments

Comments
 (0)