From 5c61509b1a17b26699b378136e93f3e9c99207ae Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Sat, 29 Dec 2018 14:14:28 +0100 Subject: [PATCH] markdown: Use python markdown implementations Support python markdown implementations when converting to html. --- keymaps.vim | 2 +- macros.vim | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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 -- 2.39.5