From ec486958ead7bf3e8375fd41db33ee3755f32102 Mon Sep 17 00:00:00 2001 From: Jaehwang Jerry Jung Date: Tue, 11 Jan 2022 02:31:57 +0900 Subject: [PATCH] Require no space after/before emphasis delimiter Many markdown implementations require that `*` be not followed (resp. preceded) by whitespace to open (resp. close) emphasis. For example, commonmark.js, Markdown.pl, and pandoc compile the follow markdown ```markdown a* asdf *a ``` to ```html

a* asdf *a

``` On the other hand, Python-Markdown allows whitespace: ```html

a asdf a

``` See https://johnmacfarlane.net/babelmark2/?normalize=1&text=a*+asdf+*a Since variants of commonmark (including GFM) are prevalent these days, it makes more sense to follow the first behavior. --- syntax/markdown.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 01d064d..e8e25d5 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -110,11 +110,11 @@ let s:concealends = '' if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1 let s:concealends = ' concealends' endif -exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends +exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\*\S\@=" end="\S\@<=\*" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\w\@