From f4f0aa786d2eb5b342f0e1754dfcd83867a7919e Mon Sep 17 00:00:00 2001 From: Jake Zimmerman Date: Mon, 30 Jun 2025 14:22:22 -0700 Subject: [PATCH] Backwards-incompatible strikethrough changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two orthogonal changes here. 1. Recent versions of Vim/Neovim support `strikethrough` text. We can use that instead of underline for `~~foo~~` in Pandoc Markdown files. 2. The `x̶` is two unicode codepoints: - `0x78`, which is ASCII `x` - `0x0336`, which in UTF-8 is two bytes: `0xCC 0xB6`. It "combining long stroke overlay" which is a diacritic, modifying the character immediately before it. Vim does not do a great job when `cchar` conceals are defined with complicated Unicode like this. Even though `x̶` renders fine in my terminal in Vim, when it's used as a conceal character, only the first byte was getting rendered. Rather than fix that, and write `x` directly, I've chosen to delete this and treat it like bold or italic regions. Given the `strikethrough` change above, it should be easy to completely conceal the strikethrough markers, like is done for bold italic, because the strikethrough will disambiguate. Users who have already added `strikeout` in the conceal blacklist (see `g:pandoc#syntax#conceal#blacklist`) will continue to have that preference disabled. Other users will see a change in the concealled preview (see screenshots). --- syntax/pandoc.vim | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/syntax/pandoc.vim b/syntax/pandoc.vim index 04e24a6..90caeb3 100644 --- a/syntax/pandoc.vim +++ b/syntax/pandoc.vim @@ -41,7 +41,6 @@ if &encoding ==# 'utf-8' \'image': '▨', \'super': 'ⁿ', \'sub': 'ₙ', - \'strike': 'x̶', \'atx': '§', \'codelang': 'λ', \'codeend': '—', @@ -60,7 +59,6 @@ else \'image': 'i', \'super': '^', \'sub': '_', - \'strike': '~', \'atx': '#', \'codelang': 'l', \'codeend': '-', @@ -393,8 +391,7 @@ call s:WithConceal('superscript', 'syn match pandocSuperscriptMark /\^/ containe " }}}3 " Strikeout: {{{3 -syn region pandocStrikeout start=/\~\~/ end=/\~\~/ contains=@Spell,pandocAmpersandEscape keepend -call s:WithConceal('strikeout', 'syn match pandocStrikeoutMark /\~\~/ contained containedin=pandocStrikeout', 'conceal cchar='.s:cchars['strike']) +call s:WithConceal('strikeout', 'syn region pandocStrikeout matchgroup=pandocOperator start=/\~\~/ end=/\~\~/ contains=@Spell,pandocAmpersandEscape keepend', 'concealends') " }}}3 " }}}2 @@ -699,11 +696,10 @@ function! s:SetupPandocHighlights() hi def link pandocNoFormattedAttrs Comment hi def link pandocSubscriptMark Operator hi def link pandocSuperscriptMark Operator - hi def link pandocStrikeoutMark Operator if g:pandoc#syntax#style#underline_special == 1 hi pandocSubscript gui=underline cterm=underline hi pandocSuperscript gui=underline cterm=underline - hi pandocStrikeout gui=underline cterm=underline + hi pandocStrikeout gui=strikethrough cterm=strikethrough endif hi def link pandocNewLine Error hi def link pandocHRule Delimiter