Skip to content

Commit eecabb9

Browse files
committed
Accept ``` as inline code marker (md/html)
1 parent eaf2d44 commit eecabb9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

autoload/xolox/notes.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ function! xolox#notes#highlight_sources(force) " {{{3
11551155
" Look for code blocks in the current note.
11561156
let filetypes = {}
11571157
for line in getline(1, '$')
1158-
let ft = matchstr(line, '{{' . '{\zs\w\+\>')
1158+
let ft = matchstr(line, '\({{\|``\)' . '\({\|`\)\zs\w\+\>')
11591159
if ft !~ '^\d*$' | let filetypes[ft] = 1 | endif
11601160
endfor
11611161
" Don't refresh the highlighting if nothing has changed.
@@ -1173,6 +1173,8 @@ function! xolox#notes#highlight_sources(force) " {{{3
11731173
let include = s:syntax_include(ft)
11741174
let command = 'syntax region %s matchgroup=%s start="{{{%s" matchgroup=%s end="}}}" keepend contains=%s%s'
11751175
execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') ? ' concealends' : '')
1176+
let command = 'syntax region %s matchgroup=%s start="```%s" matchgroup=%s end="```" keepend contains=%s%s'
1177+
execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') ? ' concealends' : '')
11761178
endfor
11771179
if &vbs >= 1
11781180
call xolox#misc#timer#stop("notes.vim %s: Highlighted embedded %s sources in %s.", g:xolox#notes#version, join(sort(keys(filetypes)), '/'), starttime)

syntax/notes.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ highlight def link notesRule Comment
158158

159159
" Highlight embedded blocks of source code, log file messages, basically anything Vim can highlight. {{{2
160160
" NB: I've escaped these markers so that Vim doesn't interpret them when editing this file…
161+
syntax match notesCodeStart /``[`]\w*/
162+
syntax match notesCodeEnd /``[`]\W/
161163
syntax match notesCodeStart /{{[{]\w*/
162164
syntax match notesCodeEnd /}}[}]/
163165
highlight def link notesCodeStart Ignore

0 commit comments

Comments
 (0)