1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
" Vim syntax file
" Language: Djot
" Maintainer: John MacFarlane
" Latest Revision: 2022-10-06
if exists("b:current_syntax")
finish
endif
syn match heading '^##* .*$'
syn match blockquote '^\s*>\%(\s\|$\)'
syn region math matchgroup=delimiter skip='[^`]{1,}' start='[$][$]\?\z(``*\)' end='\z1\|^\s*$'
syn region codespan matchgroup=delimiter skip='[^`]{1,}' start='\z(``*\)' end='\z1\|^\s*$'
syn region comment matchgroup=delimiter start='%' end='%' contained
syn region string start='"' end='"' skip='\\"'
syn region attributes matchgroup=delimiter start="{[^\[\]_*'\"=\\+-]\@=" end="}" contains=string,comment
syn region emphasis matchgroup=delimiter start='_[^[:blank:]}]\@=\|{_' end='_}\|[^[:blank:]{]\@=_\|^\s*$' contains=@inline
syn region strong matchgroup=delimiter start='\*[^[:blank:]}]\@=\|{\*' end='[^[:blank:]{]\@=\*\|\*}\|^\s*$' contains=@inline
syn region superscript matchgroup=delimiter start='\^[^[:blank:]}]\@=\|{\^' end='\^}\|[^[:blank:]{]\@=\^\|^\s*$' contains=@inline
syn region subscript matchgroup=delimiter start='\~[^[:blank:]}]\@=\|{\~' end='\~}\|[^[:blank:]{]\@=\~\|^\s*$' contains=@inline
syn region highlight matchgroup=delimiter start='{=' end='=}\|^\s*$' contains=@inline
syn match rawattribute "`\@<={=[A-Za-z0-9]*}"
syn region insert matchgroup=delimiter start='{+' end='+}\|^\s*$' contains=@inline
syn region delete matchgroup=delimiter start='{-' end='-}\|^\s*$' contains=@inline
syn match inlinelink '\[\%([^\]\\]\|\\[\]\\]\|[\r\n]\)*\](\%([^)\\]\|\\[)\\]\)*)' contains=@inline transparent
syn match linkurl '(\%([^)\\]\|\\[)\\]\)*)'hs=s+1,he=e-1 containedin=inlinelink contained
syn match referencelink '\[\%([^\]\\]\|\\[\]\\]\|[\r\n]\)*\]\[\%([^]\\]\|\\[]\\]\)*\]' contains=@inline transparent
syn match linklabel '\]\zs\[\%([^]\\]\|\\[]\\]\)*\]'hs=s+1,he=e-1 containedin=referencelink contained
syn match span '\[\%([^\]\\]\|\\[\]\\]\|[\r\n]\)*\][{]\@=' contains=@inline transparent
syn match footnoteref '\[\^[^]]*\]'
syn match openbrace /[{]["']/he=e-1
syn match closebrace /["'][}]/hs=s+1
syn match emoji ':[a-zA-Z0-9_+-]\+:'
syn match escape '\\[\r\n ~!@#$%^&*(){}`\[\]/=\\?+|\'",<-]'he=e-1
syn region djotautolinkurl matchgroup=delimiter start=/</ end=/>/
syn cluster inline contains=linkurl,emphasis,strong,codespan,attributes,rawattribute,insert,delete,superscript,subscript,highlight,math,smartquote,openbrace,closebrace,emoji,escape,footnoteref,span
syn region codeblock matchgroup=delimiter start='^\s*\z(````*\)\s*=\?\w*\s*$' end='^\s*\z1`*\s*$'
hi emphasis term=italic cterm=italic gui=italic
hi strong term=bold cterm=bold gui=bold
hi def link insert Todo
hi def link delete Error
hi def link superscript Statement
hi def link subscript Statement
hi def link highlight Todo
hi def link heading Label
hi def link codespan Tag
hi def link math Statement
hi def link emoji Statement
hi def link span Statement
hi def link codeblock Tag
hi def link string String
hi def link inlinelink Typedef
hi def link footnoteref Statement
hi def link linkurl Underlined
hi def link djotautolinkurl Underlined
hi def link comment Comment
hi def link linklabel Underlined
hi def link escaped Typedef
hi def link attributes Identifier
hi def link rawattribute Identifier
hi def link delimiter Ignore
hi def link escape Ignore
hi def link openbrace Ignore
hi def link closebrace Ignore
hi def link blockquote Comment
let b:current_syntax = "djot"
|