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 ;)
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
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',
\ 'template_ext': '.tpl'}]
The most important part is the 'custom_wiki2html': 'vimwiki_markdown'
In vimwiki at the moment, it deletes any files in the site_html directory which do not match against the markdown files (once they are translated into linked html). Now, in vimwiki_markdown we use ActiveSupports paramaterized method, as it's nicer on links. If you want to have a significant speed up, then you need to patch your vimwiki plugin to not delete files it shouldn't be. Here are links to the relevant bits:
- Add this function
- Make the is_html_uptodate look like this
- For the moment, remove the call to deleting files
call s:delete_html_files(path_html)
- will work out a way around that later, not there now. - Might be some other things, check the diff in the above commits or open an issue.
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 ;)
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 tag you put
%pygments%
A sample tpl file is available here https://raw.githubusercontent.com/patrickdavey/vimwiki_markdown/master/example_files/default.tpl
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)
Including a line with %template <template name>
in any of your Vimwiki pages will will force the generator to use <template name>.tpl
rather than default.tpl
for that page.
<template name>
cannot contain any spaces
Including a line with %title <title name>
in any of your Vimwiki pages will force the generator to replace %title%
in your template file with <title name>
rather than the name of the file itself.
You can have spaces in your titles now!
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