Skip to content

Commit f16cd3a

Browse files
committed
add minimized flavor
1 parent 5e0bfa8 commit f16cd3a

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

syntax/pandoc.vim

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ endif
1515

1616
if exists('g:pandoc#syntax#flavor#commonmark') || exists('b:pandoc#syntax#flavor#commonmark')
1717
runtime syntax/pandoc_commonmark.vim
18+
elseif exists('g:pandoc#syntax#flavor#minimized') || exists('b:pandoc#syntax#flavor#minimized')
19+
runtime syntax/pandoc_minimized.vim
1820
else
1921
runtime syntax/pandoc_legacy.vim
2022
endif

syntax/pandoc_minimized.vim

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
" Vim syntax file
2+
" Filetype: pandoc
3+
" Language: pandoc markdown, simplified
4+
" Maintainer: Felipe Morales <[email protected]>
5+
6+
scriptencoding utf-8
7+
8+
syntax clear
9+
10+
syn spell toplevel
11+
12+
" A pandoc markdown document is based on blocks.
13+
14+
syn region pdcPar start=/^\s*[[:print:]]/ end=/[[:print:]]\(\n\s*\n\)\@=/ keepend contains=@Spell
15+
16+
" YAML headers
17+
unlet! b:current_syntax
18+
syn include @YAML syntax/yaml.vim
19+
syn region pdcYAML matchgroup=Delimiter start=/^\s*---\(\n\s*[[:print:]]\)\@=/ end=/---\n\s*\n/ keepend contains=@YAML
20+
21+
" LaTeX environments
22+
unlet! b:current_syntax
23+
syn include @LATEX syntax/tex.vim
24+
syn region pdcLaTeXEnv start=/\\begin{\z(.\{-}\)}/ end=/\\end{\z1}/ keepend contains=@LATEX
25+
syn region pdcLaTeXDisplayMath start=/\z(\\\@<!\$\{1,2}\)/ end=/\z1/ keepend contains=@LATEX containedin=pdcPar,pdcBlockQuote,pdcOList,pdcUList,pdcFootnote,pdcFootnotePar,pdcInlineFootnote
26+
syn match pdcLaTeXCmd /\\[[:alpha:]]\+\(\({.\{-}}\)\=\(\[.\{-}\]\)\=\)*/ contains=@LATEX keepend containedin=pdcPar,pdcBlockQuote,pdcOList,pdcUList,pdcFootnote,pdcFootnotePar,pdcInlineFootnote
27+
28+
" Code Blocks
29+
syn region pdcCodeblock start=/^\(\s\{4,}\|\t\{1,}\)/ end=/[[:print:]]\zs\n\ze\s*\n/
30+
syn region pdcDelimitedCodeBlock start=/^\z([`~]\{3}\)/ end=/\z1\n\s*\n/
31+
syn region pdcLaTeXCodeBlock matchgroup=Delimiter start=/^```{=latex}/ end=/```\n\s*\n/ keepend contains=@LATEX
32+
33+
" Blockquotes
34+
syn region pdcBlockQuote start=/^\s\{,3}>\s\?/ end=/[[:print:]]\(\n\s*\n\)\@=/ keepend
35+
36+
" Lists
37+
syn region pdcUList start=/^\s*[*=-][*=-]\@!\ze\s*[[:print:]]/ end=/[[:print:]]\(\n\s*\n\)\@=/ keepend
38+
syn region pdcOList start=/^(\?\(\d\+\|\l\|\#\|@.\{-}\|x\=l\=\(i\{,3}[vx]\=\)\{,3}c\{,3}\)[.)]/ end=/[[:print:]]\(\n\s*\n\)\@=/ keepend
39+
40+
" Definitions
41+
syn region pdcDefinition matchgroup=Label start=/^[[:print:]]\{1,}\ze\s*\n\~/ end=/[[:print:]]\zs\(\n\s*\n\)\@=/ keepend contains=@Spell
42+
43+
" Fenced DIVS
44+
syn region pdcFencedDiv matchgroup=Delimiter start=/^:::.*$/ end=/:::\n\s*\n/ keepend contains=@LATEX,pdcPar contains=@Spell
45+
46+
" Atx headers
47+
syn match pdcAtxHeader /\(\%^\|<.\+>.*\n\|^\s*\n\)\@<=#\{1,6}.*\n/ keepend contained containedin=pdcPar contains=@Spell
48+
49+
" Footnotes
50+
syn region pdcFootnote start=/^\[\^/ end=/[[:print:]]\zs\n\ze\s*\n/ keepend contains=@Spell
51+
syn region pdcInlineFootnote matchgroup=Delimiter start=/\^\[/ skip=/\[[[:print:]]*\]/ end=/\]/ keepend contained containedin=pdcPar,pdcUList,pdcOList
52+
syn region pdcFootnoteRef matchgroup=Delimiter start=/\[\^/ end=/\]/ contained containedin=pdcPar,pdcBlockQuote,pdcUList,pdcOList,pdcFootnote nextgroup=pdcFootnotePar
53+
syn region pdcFootnotePar start=/^\t[[:print:]]/ end=/[[:print:]]\(\n\s*\n\)\@=/ keepend contains=@Spell nextgroup=pdcFootnotePar
54+
55+
" References.
56+
syn match pdcBibRef /@[[:alnum:]:_-]\{1,}\(\[[[:print:]]\{-}\]\)\?/ containedin=pdcPar,pdcUList,pdcOList,pdcBlockQuote
57+
syn match pdcBibRefIF /@[[:alnum:]:_-]\{1,}\(\[[[:print:]]\{-}\]\)\?/ containedin=pdcInlineFootnote,pdcFootnote,pdcFootnotePar
58+
59+
" Highlighting
60+
61+
hi def link pdcCodeblock Special
62+
hi def link pdcDelimitedCodeBlock pdcCodeblock
63+
hi def link pdcAtxHeader Directory
64+
hi def link pdcFootnote Comment
65+
hi def link pdcInlineFootnote pdcFootnote
66+
hi def link pdcFootnotePar pdcFootnote
67+
hi def link pdcFootnoteBlockQuote pdcFootnote
68+
hi def pdcBodyLink ctermfg=fg guifg=fg guisp=SteelBlue4 gui=underline cterm=underline
69+
let fn_fg = pandoc#syntax#color#Instrospect('pdcInlineFootnote').guifg
70+
exe 'hi def pdcFootLink guifg='.fn_fg.' guisp=SteelBlue4 gui=underline cterm=underline'
71+
hi def link pdcBibRef pdcBodyLink
72+
hi def link pdcFootnoteRef pdcFootLink
73+
hi def link pdcBibRefIF pdcFootLink

0 commit comments

Comments
 (0)