vimwiki & markdown HTML export

In the vim list section of the .vimrcfile, include options:

let g:vimwiki_list = [{"path": ‘your_wiki_place”, "path_html": ‘wiki_html_location’, "syntax": 'markdown', "ext": '.mkd', "css_file": ‘location of designated css’, "custom_wiki2html": ‘link to the custom converter, i.e. misaka_md2html.py', "auto_export": 1}]

Break down to the details:

  • path: the original wiki files
  • path_html: the output html location
  • syntax: set as markdown
  • ext: whatever needed, you can use .md or something else
  • custom_wiki2html: the converter executable location, i.e. the md2html script from Github
  • auto_export: you may want auto export enabled

Just beware, according from the vimwiki docs,

The following arguments, in this order, are passed to the |vimwiki-option-custom_wiki2html| script:

  1. force : [0/1] overwrite an existing file
  2. syntax : the syntax chosen for this wiki
  3. extension : the file extension for this wiki
  4. output_dir : the full path of the output directory, i.e. ‘path_html’
  5. input_file : the full path of the wiki page
  6. css_file : the full path of the css file for this wiki
  7. template_path : the full path to the wiki’s templates
  8. template_default : the default template name
  9. template_ext : the extension of template files
  10. root_path : a count of ../ for pages buried in subdirs if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then e %root_path% is replaced by ‘../../../’.

Options 7-10 are experimental and may change in the future. If any of these parameters is empty, then a hyphen “-“ is passed to the script in its place.

The current python script may not able to accept these options as they only accepting staring 7 arguments, so far I add the handler into python script as these to make script working:

parser.add_argument("cssfile", help="The css file (with absolute path) to "
        "be referenced in the resulting html file.")
_# modification start here_
parser.add_argument("template_path", help="The css file (with absolute path) to "
        "be referenced in the resulting html file.")
parser.add_argument("template_default", help="The css file (with absolute path) to "
        "be referenced in the resulting html file.")
parser.add_argument("template_ext", help="The css file (with absolute path) to "
        "be referenced in the resulting html file.")
parser.add_argument("root_path", help="The css file (with absolute path) to "
        "be referenced in the resulting html file.”)
# modification ends
ns = parser.parse_args()

Voila.

01 Jun 2014