From 631270d2c1e359654b675c6ac968a134aa554313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20L=C3=A9vigne?= Date: Wed, 27 Mar 2019 15:36:08 +0100 Subject: [PATCH 1/2] Add option vim_markdown_preview_pandoc_css Add an option to specify a css file for genration with pandoc. In the vimrc : let vim_markdown_preview_pandoc_css='/absolute/path/to/file.css' --- plugin/vim-markdown-preview.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index 082c69f..3bba41e 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -50,6 +50,10 @@ if !exists("g:vim_markdown_preview_pandoc") let g:vim_markdown_preview_pandoc = 0 endif +if !exists("g:vim_markdown_preview_pandoc_css") + let g:vim_markdown_preview_pandoc_css = '' +endif + if !exists("g:vim_markdown_preview_use_xdg_open") let g:vim_markdown_preview_use_xdg_open = 0 endif @@ -65,8 +69,10 @@ function! Vim_Markdown_Preview() 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') - elseif g:vim_markdown_preview_pandoc == 1 + elseif g:vim_markdown_preview_pandoc == 1 && g:vim_markdown_preview_pandoc_css == '' call system('pandoc --standalone "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') + elseif g:vim_markdown_preview_pandoc == 1 + call system('pandoc --standalone -c "' . g:vim_markdown_preview_pandoc_css . '" "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') else call system('markdown "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') endif @@ -119,8 +125,10 @@ function! Vim_Markdown_Preview_Local() 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') - elseif g:vim_markdown_preview_pandoc == 1 + elseif g:vim_markdown_preview_pandoc == 1 && g:vim_markdown_preview_pandoc_css == '' call system('pandoc --standalone "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') + elseif g:vim_markdown_preview_pandoc == 1 + call system('pandoc --standalone -c "' . g:vim_markdown_preview_pandoc_css . '" "' . b:curr_file . '" > /tmp/vim-markdown-preview.html') else call system('markdown "' . b:curr_file . '" > vim-markdown-preview.html') endif From 7740cc17199025217d1dce903b129ce4b1600b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20L=C3=A9vigne?= Date: Mon, 1 Apr 2019 15:32:17 +0200 Subject: [PATCH 2/2] Add documentation for markdown_preview_pandoc_css --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 1923b23..1b989b0 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Vim Markdown Preview - [Github Flavoured Markdown](#github) - [Markdown.pl](#perl) - [Pandoc](#pandoc) + - [Pandoc CSS](#pandoc_css) - [Use xdg-open](#xdg) - [Behind the Scenes](#behind-the-scenes) @@ -164,6 +165,17 @@ Example: Use Pandoc to render HTML. let vim_markdown_preview_pandoc=1 ``` + +### The `vim_markdown_preview_pandoc_css` option +If you use pandoc to render HTML, you can specify a CSS file with this option. + +Default: `''` + +Example: Specify a CSS file for HTML. +```vim +let vim_markdown_preview_pandoc_css='/absolute/path/to/file.css' +``` + ### The `vim_markdown_preview_use_xdg_open` option