From 88db6024b93ca7bbc2137f5539768ed697e2f711 Mon Sep 17 00:00:00 2001 From: Rodrigo Haenggi Date: Thu, 14 Feb 2013 21:21:29 +0100 Subject: [PATCH 1/5] strikethrough support as requested in #26 --- syntax/markdown.vim | 88 +++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/syntax/markdown.vim b/syntax/markdown.vim index e0a09dc..e9cdb5a 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -116,6 +116,7 @@ exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\*\*\S\@=" exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\w\@#+.!-]" syn match markdownError "\w\@<=_\w\@=" -hi def link markdownH1 htmlH1 -hi def link markdownH2 htmlH2 -hi def link markdownH3 htmlH3 -hi def link markdownH4 htmlH4 -hi def link markdownH5 htmlH5 -hi def link markdownH6 htmlH6 -hi def link markdownHeadingRule markdownRule -hi def link markdownH1Delimiter markdownHeadingDelimiter -hi def link markdownH2Delimiter markdownHeadingDelimiter -hi def link markdownH3Delimiter markdownHeadingDelimiter -hi def link markdownH4Delimiter markdownHeadingDelimiter -hi def link markdownH5Delimiter markdownHeadingDelimiter -hi def link markdownH6Delimiter markdownHeadingDelimiter -hi def link markdownHeadingDelimiter Delimiter -hi def link markdownOrderedListMarker markdownListMarker -hi def link markdownListMarker htmlTagName -hi def link markdownBlockquote Comment -hi def link markdownRule PreProc - -hi def link markdownFootnote Typedef -hi def link markdownFootnoteDefinition Typedef - -hi def link markdownLinkText htmlLink -hi def link markdownIdDeclaration Typedef -hi def link markdownId Type -hi def link markdownAutomaticLink markdownUrl -hi def link markdownUrl Float -hi def link markdownUrlTitle String -hi def link markdownIdDelimiter markdownLinkDelimiter -hi def link markdownUrlDelimiter htmlTag -hi def link markdownUrlTitleDelimiter Delimiter - -hi def link markdownItalic htmlItalic -hi def link markdownItalicDelimiter markdownItalic -hi def link markdownBold htmlBold -hi def link markdownBoldDelimiter markdownBold -hi def link markdownBoldItalic htmlBoldItalic -hi def link markdownBoldItalicDelimiter markdownBoldItalic -hi def link markdownCodeDelimiter Delimiter - -hi def link markdownEscape Special -hi def link markdownError Error +hi def link markdownH1 htmlH1 +hi def link markdownH2 htmlH2 +hi def link markdownH3 htmlH3 +hi def link markdownH4 htmlH4 +hi def link markdownH5 htmlH5 +hi def link markdownH6 htmlH6 +hi def link markdownHeadingRule markdownRule +hi def link markdownH1Delimiter markdownHeadingDelimiter +hi def link markdownH2Delimiter markdownHeadingDelimiter +hi def link markdownH3Delimiter markdownHeadingDelimiter +hi def link markdownH4Delimiter markdownHeadingDelimiter +hi def link markdownH5Delimiter markdownHeadingDelimiter +hi def link markdownH6Delimiter markdownHeadingDelimiter +hi def link markdownHeadingDelimiter Delimiter +hi def link markdownOrderedListMarker markdownListMarker +hi def link markdownListMarker htmlTagName +hi def link markdownBlockquote Comment +hi def link markdownRule PreProc + +hi def link markdownFootnote Typedef +hi def link markdownFootnoteDefinition Typedef + +hi def link markdownLinkText htmlLink +hi def link markdownIdDeclaration Typedef +hi def link markdownId Type +hi def link markdownAutomaticLink markdownUrl +hi def link markdownUrl Float +hi def link markdownUrlTitle String +hi def link markdownIdDelimiter markdownLinkDelimiter +hi def link markdownUrlDelimiter htmlTag +hi def link markdownUrlTitleDelimiter Delimiter + +hi def link markdownItalic htmlItalic +hi def link markdownItalicDelimiter markdownItalic +hi def link markdownBold htmlBold +hi def link markdownBoldDelimiter markdownBold +hi def link markdownBoldItalic htmlBoldItalic +hi def link markdownBoldItalicDelimiter markdownBoldItalic +hi def link markdownStrikethrough Comment +hi def link markdownStrikethroughDelimiter Comment + +hi def link markdownCodeDelimiter Delimiter + +hi def link markdownEscape Special +hi def link markdownError Error let b:current_syntax = "markdown" if main_syntax ==# 'markdown' From e361a6fab8e4ebe6f55d58d484dcaa5f7362f36e Mon Sep 17 00:00:00 2001 From: Joseph Adams Date: Fri, 21 Jan 2022 13:18:45 +0100 Subject: [PATCH 2/5] Use htmlStrike highlight group instead of Comment --- syntax/markdown.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/markdown.vim b/syntax/markdown.vim index e9cdb5a..57ac6fc 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -181,8 +181,8 @@ hi def link markdownBold htmlBold hi def link markdownBoldDelimiter markdownBold hi def link markdownBoldItalic htmlBoldItalic hi def link markdownBoldItalicDelimiter markdownBoldItalic -hi def link markdownStrikethrough Comment -hi def link markdownStrikethroughDelimiter Comment +hi def link markdownStrikethrough htmlStrike +hi def link markdownStrikethroughDelimiter htmlStrike hi def link markdownCodeDelimiter Delimiter From 877478f337f1b45cf869d22472f4a80822ac4199 Mon Sep 17 00:00:00 2001 From: Joseph Adams Date: Fri, 21 Jan 2022 16:59:33 +0100 Subject: [PATCH 3/5] Make strikethrough synatax group more robust As pointed out by @tomtomjhj it would be good to follow the lead of the other emphasis syntax groups: allow no whitespace after/before the emphasis delimiter and also don't let emphasis span multiple lines. --- syntax/markdown.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 57ac6fc..1783dc1 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -116,7 +116,7 @@ exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\*\*\S\@=" exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\w\@ Date: Sat, 22 Jan 2022 09:36:30 +0100 Subject: [PATCH 4/5] Rename highlight group to avoid realign from prev commit. --- syntax/markdown.vim | 92 ++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 1783dc1..91ab95b 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -116,7 +116,7 @@ exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\*\*\S\@=" exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\w\@#+.!-]" syn match markdownError "\w\@<=_\w\@=" -hi def link markdownH1 htmlH1 -hi def link markdownH2 htmlH2 -hi def link markdownH3 htmlH3 -hi def link markdownH4 htmlH4 -hi def link markdownH5 htmlH5 -hi def link markdownH6 htmlH6 -hi def link markdownHeadingRule markdownRule -hi def link markdownH1Delimiter markdownHeadingDelimiter -hi def link markdownH2Delimiter markdownHeadingDelimiter -hi def link markdownH3Delimiter markdownHeadingDelimiter -hi def link markdownH4Delimiter markdownHeadingDelimiter -hi def link markdownH5Delimiter markdownHeadingDelimiter -hi def link markdownH6Delimiter markdownHeadingDelimiter -hi def link markdownHeadingDelimiter Delimiter -hi def link markdownOrderedListMarker markdownListMarker -hi def link markdownListMarker htmlTagName -hi def link markdownBlockquote Comment -hi def link markdownRule PreProc - -hi def link markdownFootnote Typedef -hi def link markdownFootnoteDefinition Typedef - -hi def link markdownLinkText htmlLink -hi def link markdownIdDeclaration Typedef -hi def link markdownId Type -hi def link markdownAutomaticLink markdownUrl -hi def link markdownUrl Float -hi def link markdownUrlTitle String -hi def link markdownIdDelimiter markdownLinkDelimiter -hi def link markdownUrlDelimiter htmlTag -hi def link markdownUrlTitleDelimiter Delimiter - -hi def link markdownItalic htmlItalic -hi def link markdownItalicDelimiter markdownItalic -hi def link markdownBold htmlBold -hi def link markdownBoldDelimiter markdownBold -hi def link markdownBoldItalic htmlBoldItalic -hi def link markdownBoldItalicDelimiter markdownBoldItalic -hi def link markdownStrikethrough htmlStrike -hi def link markdownStrikethroughDelimiter htmlStrike - -hi def link markdownCodeDelimiter Delimiter - -hi def link markdownEscape Special -hi def link markdownError Error +hi def link markdownH1 htmlH1 +hi def link markdownH2 htmlH2 +hi def link markdownH3 htmlH3 +hi def link markdownH4 htmlH4 +hi def link markdownH5 htmlH5 +hi def link markdownH6 htmlH6 +hi def link markdownHeadingRule markdownRule +hi def link markdownH1Delimiter markdownHeadingDelimiter +hi def link markdownH2Delimiter markdownHeadingDelimiter +hi def link markdownH3Delimiter markdownHeadingDelimiter +hi def link markdownH4Delimiter markdownHeadingDelimiter +hi def link markdownH5Delimiter markdownHeadingDelimiter +hi def link markdownH6Delimiter markdownHeadingDelimiter +hi def link markdownHeadingDelimiter Delimiter +hi def link markdownOrderedListMarker markdownListMarker +hi def link markdownListMarker htmlTagName +hi def link markdownBlockquote Comment +hi def link markdownRule PreProc + +hi def link markdownFootnote Typedef +hi def link markdownFootnoteDefinition Typedef + +hi def link markdownLinkText htmlLink +hi def link markdownIdDeclaration Typedef +hi def link markdownId Type +hi def link markdownAutomaticLink markdownUrl +hi def link markdownUrl Float +hi def link markdownUrlTitle String +hi def link markdownIdDelimiter markdownLinkDelimiter +hi def link markdownUrlDelimiter htmlTag +hi def link markdownUrlTitleDelimiter Delimiter + +hi def link markdownItalic htmlItalic +hi def link markdownItalicDelimiter markdownItalic +hi def link markdownBold htmlBold +hi def link markdownBoldDelimiter markdownBold +hi def link markdownBoldItalic htmlBoldItalic +hi def link markdownBoldItalicDelimiter markdownBoldItalic +hi def link markdownStrike htmlStrike +hi def link markdownStrikeDelimiter htmlStrike + +hi def link markdownCodeDelimiter Delimiter + +hi def link markdownEscape Special +hi def link markdownError Error let b:current_syntax = "markdown" if main_syntax ==# 'markdown' From a9779083a86c282b56cf2cb496ab0ae4cefce4df Mon Sep 17 00:00:00 2001 From: Joseph Adams Date: Mon, 24 Jan 2022 11:53:55 +0100 Subject: [PATCH 5/5] Point `markdownStrikeDelimiter` to `markdownStrike` highlight group. --- syntax/markdown.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 91ab95b..583767b 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -182,7 +182,7 @@ hi def link markdownBoldDelimiter markdownBold hi def link markdownBoldItalic htmlBoldItalic hi def link markdownBoldItalicDelimiter markdownBoldItalic hi def link markdownStrike htmlStrike -hi def link markdownStrikeDelimiter htmlStrike +hi def link markdownStrikeDelimiter markdownStrike hi def link markdownCodeDelimiter Delimiter