Skip to content

Commit

Permalink
Merge pull request #25 from joelostblom/python-codeblocks
Browse files Browse the repository at this point in the history
Highlight Python syntax in code chunks
  • Loading branch information
fmoralesc authored Aug 5, 2019
2 parents 1b97e1d + dff9919 commit a1787cb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions syntax/rmarkdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ exe 'syn region pandocRChunk '.
\'contained containedin=pandocDelimitedCodeblock contains=@R'

syn region pandocInlineR matchgroup=Operator start=/`r\s/ end=/`/ contains=@R concealends

PandocHighlight python
" rmarkdown recognizes embedded R differently than regular pandoc
exe 'syn region pandocPythonChunk '.
\'start=/\(```\s*{\s*python.*\n\)\@<=\_^/ ' .
\'end=/\_$\n\(\(\s\{4,}\)\=\(`\{3,}`*\|\~\{3,}\~*\)\_$\n\_$\)\@=/ '.
\'contained containedin=pandocDelimitedCodeblock contains=@python'

syn region pandocInlinePython matchgroup=Operator start=/`python\s/ end=/`/ contains=@Python concealends

0 comments on commit a1787cb

Please sign in to comment.