From 2cee512ddca87818f0ec34246c9c794877cd9001 Mon Sep 17 00:00:00 2001 From: JamshedVesuna Date: Mon, 26 Dec 2016 08:57:44 -0800 Subject: [PATCH] Support Markdown.pl --- README.md | 12 ++++++++++++ plugin/vim-markdown-preview.vim | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 6dece66..2a7d4fa 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Vim Markdown Preview - [Browser](#browser) - [Temp File](#temp) - [Github Flavoured Markdown](#github) + - [Markdown.pl](#perl) - [Use xdg-open](#xdg) - [Behind the Scenes](#behind-the-scenes) @@ -140,6 +141,17 @@ Example: Use GitHub flavoured markdown. let vim_markdown_preview_github=1 ``` + +### The `vim_markdown_preview_perl` option +If you prefer to use John Gruber's [Markdown.pl](https://daringfireball.net/projects/markdown/) to render HTML, set the following flag: + +Default: `0` + +Example: Use Markdown.pl to render HTML. +```vim +let vim_markdown_preview_perl=1 +``` + ### The `vim_markdown_preview_use_xdg_open` option diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index 7794a86..085118a 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -21,6 +21,10 @@ if !exists("g:vim_markdown_preview_github") let g:vim_markdown_preview_github = 0 endif +if !exists("g:vim_markdown_preview_perl") + let g:vim_markdown_preview_perl = 0 +endif + if !exists("g:vim_markdown_preview_use_xdg_open") let g:vim_markdown_preview_use_xdg_open = 0 endif @@ -54,6 +58,8 @@ function! Vim_Markdown_Preview() if g:vim_markdown_preview_github == 1 call system('grip "' . b:curr_file . '" --export /tmp/vim-markdown-preview.html --title vim-markdown-preview.html') + elseif g:vim_markdown_preview_perl == 1 + call system('Markdown.pl "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') else call system('markdown "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') endif @@ -101,6 +107,8 @@ function! Vim_Markdown_Preview_Local() if g:vim_markdown_preview_github == 1 call system('grip "' . b:curr_file . '" --export vim-markdown-preview.html --title vim-markdown-preview.html') + elseif g:vim_markdown_preview_perl == 1 + call system('Markdown.pl "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') else call system('markdown "' . b:curr_file . '" > vim-markdown-preview.html') endif -- 2.45.2