markdown: Use python markdown implementations
authorStefan Huber <shuber@sthu.org>
Sat, 29 Dec 2018 13:14:28 +0000 (14:14 +0100)
committerStefan Huber <shuber@sthu.org>
Sat, 29 Dec 2018 13:14:28 +0000 (14:14 +0100)
Support python markdown implementations when converting to html.

keymaps.vim
macros.vim

index 7f04452831005fddea1498ff5134a9c12e8b5fcc..1ad0f136850807a3a045d6207c485c7ff9d67c25 100644 (file)
@@ -21,7 +21,7 @@ au Filetype c,cpp,objc map <buffer> <F11> :vsplit<CR>:FSRight<CR>
 au Filetype c,cpp,objc map <buffer> <S-F11> :FSHere<CR>
 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
 
 au Filetype c,cpp,objc map <buffer> <S-F11> :FSHere<CR>
 au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
 
-au Filetype markdown map <buffer> <F5> :call RunPandoc()<CR>
+au Filetype markdown map <buffer> <F5> :call RunMarkdown()<CR>
 
 " Start interactive EasyAlign in visual mode (e.g. vipga)
 vmap <Enter> <Plug>(EasyAlign)
 
 " Start interactive EasyAlign in visual mode (e.g. vipga)
 vmap <Enter> <Plug>(EasyAlign)
index dd0b28dd605d6cfc81db27bbb59e35b7bc386ed7..73ce12864cca1fefa1aaf7c031349ed54bca252c 100644 (file)
@@ -96,6 +96,22 @@ function RunPandoc()
   execute ":!pandoc " . cssopts . " --self-contained --toc " . @% . " -o " . @% . ".html"
 endfunction
 
   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
 
 if filereadable($HOME . '/.vim/macros-local.vim')
   source ~/.vim/macros-local.vim