From: Stefan Huber Date: Sat, 29 Dec 2018 13:14:28 +0000 (+0100) Subject: markdown: Use python markdown implementations X-Git-Url: https://git.sthu.org/?p=vimconf.git;a=commitdiff_plain;h=5c61509b1a17b26699b378136e93f3e9c99207ae;hp=cdf1fddcd88dace1209bff22fee2337ee9ff9a01 markdown: Use python markdown implementations Support python markdown implementations when converting to html. --- diff --git a/keymaps.vim b/keymaps.vim index 7f04452..1ad0f13 100644 --- a/keymaps.vim +++ b/keymaps.vim @@ -21,7 +21,7 @@ au Filetype c,cpp,objc map :vsplit:FSRight au Filetype c,cpp,objc map :FSHere au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards() -au Filetype markdown map :call RunPandoc() +au Filetype markdown map :call RunMarkdown() " Start interactive EasyAlign in visual mode (e.g. vipga) vmap (EasyAlign) diff --git a/macros.vim b/macros.vim index dd0b28d..73ce128 100644 --- a/macros.vim +++ b/macros.vim @@ -96,6 +96,22 @@ function RunPandoc() execute ":!pandoc " . cssopts . " --self-contained --toc " . @% . " -o " . @% . ".html" endfunction +function RunMarkdownpy(prog) + execute ":!" . a:prog . " " . @% . " > " . @% . ".html" +endfunction + +function RunMarkdown() + if executable("pandoc") + call RunPandoc() + elseif executable("markdown2") + call RunMarkdownpy("markdown2") + elseif executable("markdown_py") + call RunMarkdownpy("markdown_py") + else + echo "No markdown implementation found." + endif +endfunction + if filereadable($HOME . '/.vim/macros-local.vim') source ~/.vim/macros-local.vim