Skip to content

Commit f4f0aa7

Browse files
committed
Backwards-incompatible strikethrough changes
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).
1 parent ea3fc41 commit f4f0aa7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

syntax/pandoc.vim

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ if &encoding ==# 'utf-8'
4141
\'image': '▨',
4242
\'super': 'ⁿ',
4343
\'sub': 'ₙ',
44-
\'strike': 'x̶',
4544
\'atx': '§',
4645
\'codelang': 'λ',
4746
\'codeend': '—',
@@ -60,7 +59,6 @@ else
6059
\'image': 'i',
6160
\'super': '^',
6261
\'sub': '_',
63-
\'strike': '~',
6462
\'atx': '#',
6563
\'codelang': 'l',
6664
\'codeend': '-',
@@ -393,8 +391,7 @@ call s:WithConceal('superscript', 'syn match pandocSuperscriptMark /\^/ containe
393391
" }}}3
394392

395393
" Strikeout: {{{3
396-
syn region pandocStrikeout start=/\~\~/ end=/\~\~/ contains=@Spell,pandocAmpersandEscape keepend
397-
call s:WithConceal('strikeout', 'syn match pandocStrikeoutMark /\~\~/ contained containedin=pandocStrikeout', 'conceal cchar='.s:cchars['strike'])
394+
call s:WithConceal('strikeout', 'syn region pandocStrikeout matchgroup=pandocOperator start=/\~\~/ end=/\~\~/ contains=@Spell,pandocAmpersandEscape keepend', 'concealends')
398395
" }}}3
399396

400397
" }}}2
@@ -699,11 +696,10 @@ function! s:SetupPandocHighlights()
699696
hi def link pandocNoFormattedAttrs Comment
700697
hi def link pandocSubscriptMark Operator
701698
hi def link pandocSuperscriptMark Operator
702-
hi def link pandocStrikeoutMark Operator
703699
if g:pandoc#syntax#style#underline_special == 1
704700
hi pandocSubscript gui=underline cterm=underline
705701
hi pandocSuperscript gui=underline cterm=underline
706-
hi pandocStrikeout gui=underline cterm=underline
702+
hi pandocStrikeout gui=strikethrough cterm=strikethrough
707703
endif
708704
hi def link pandocNewLine Error
709705
hi def link pandocHRule Delimiter

0 commit comments

Comments
 (0)