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

Incorrect processing of "_"

Open kossnocorp opened this issue 12 years ago • 6 comments

"_" is a underscore. This is _undeline_.

Result: "_" is a underscore. This is undeline.

But with vim-markdown:

Screen Shot 2013-04-08 at 12 17 17 PM

kossnocorp avatar Apr 08 '13 05:04 kossnocorp

Can you tell me how #16 works for you? I never got around to thoroughly evaluating it.

tpope avatar Apr 11 '13 20:04 tpope

I think this issue is a duplicate of #27.

positron avatar Oct 19 '13 21:10 positron

Another underscore issue:

screen shot 2014-01-09 at 3 02 21 pm

Notice the italics, but these are not (and should not be rendered):

screen shot 2014-01-09 at 3 04 35 pm

smackesey avatar Jan 09 '14 23:01 smackesey

It appears that Github's parser now agrees with vim-markdown's, which is unfortunate I think.

2014-03-14 at 3 02 pm

calebhearth avatar Mar 14 '14 19:03 calebhearth

Yeah this stuff is super flaky and implementation dependent. If you're writing markdown, you should just always escape underscores to be safe. I'm open to improvements in the highlighting but I don't think there's a "correct" solution.

tpope avatar Mar 14 '14 19:03 tpope

I agree that I don't think there's a correct solution. I do however find highlighting an internal underscore as an error to be quite distracting. I disabled this behaviour with the following patch:

diff --git a/markdown.vim.orig b/markdown.vim
index 068115e..030fcdb 100644
--- a/markdown.vim.orig
+++ b/markdown.vim
@@ -93,7 +93,7 @@ if main_syntax ==# 'markdown'
 endif

 syn match markdownEscape "\\[][\\`*_{}()#+.!-]"
-syn match markdownError "\w\@<=_\w\@="
+syn match markdownError "\w\@<=\w\@="

 hi def link markdownH1                    htmlH1
 hi def link markdownH2                    htmlH2

sjackman avatar May 14 '14 17:05 sjackman