Ⅰ. 插件描述
A gem to use for converting vimwiki markdown files to html.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'patrickdavey/vimwiki-markdown'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'patrickdavey/vimwiki-markdown'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'patrickdavey/vimwiki-markdown'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/patrickdavey/vimwiki_markdown
Ⅳ. 文档说明
This gem allows vimwiki pages written in (github enhanced) markdown
to be converted to HTML.
It is currently a work in progress (but working for me ;)
Requirements
Ruby installed on your computer & up to date version of vimwiki
https://www.ruby-lang.org/en/installation/
Install the vimwiki_markdown gem
$ gem install vimwiki_markdown
Setup
vimwiki_markdown works best with a recent version of vimwiki. Use the dev branch for best results.
Ensure that your vimiwiki directive in your .vimrc is setup for markdown. For
this we use the custom_wiki2html parameter. My .vimrc looks like this:
let g:vimwiki_list = [{'path': '~/vimwiki', 'template_path': '~/vimwiki/templates/',
\ 'template_default': 'default', 'syntax': 'markdown', 'ext': '.md',
\ 'path_html': '~/vimwiki/site_html/', 'custom_wiki2html': 'vimwiki_markdown',
\ 'html_filename_parameterization': 1,
\ 'template_ext': '.tpl'}]
The most important parts are the 'custom_wiki2html': 'vimwiki_markdown' and the 'html_filename_parameterization': 1. The custom_wiki2html tells vimwiki to use this gem for creating html, the html_filename_parameterization tells vimwiki to match the filenames that vimwiki_markdown produces.
Install issues.
There have been some issues with getting dependencies installed. Before opening an issue, please check if you can use rvm to install the gem, as RVM is magic and makes everything work ;)
VimWiki Template
It is a requirement that your template file contain a placeholder
for the syntax highlighting code to be placed. In order to do this,
open up your default.tpl (or whatever your template file is called)
and ensure that before the closing </head> tag you put%pygments%
A sample tpl file is available here https://raw.githubusercontent.com/patrickdavey/vimwiki_markdown/master/example_files/default.tpl
Optional %root_html% marker.
You can also have a %root_html% marker in your template file, thanks
to this commit.
It will get rewritten with the relative path to the root
of the site (e.g. ./ or ../../ etc)
Optional %date% marker.
You can also have a %date% marker in your template file
It will get rewritten with todays date in the format 29 March 2019
Optional %nohtml
If you place the text %nohtml anywhere in a wiki page, it will not be processed into html
Contributing
Pull requests are very welcome, especially if you want to implement some of the
more interesting vimwiki links (e.g. :local etc.)
- Fork it ( https://github.com/patrickdavey/vimwiki_markdown/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request