patrickdavey / vimwiki_markdown

A gem to use for converting vimwiki markdown files to html.
MIT License
144 stars 16 forks source link

add simple support for %root_path% substitutions in template #3

Closed okayzed closed 7 years ago

okayzed commented 7 years ago

I want to use a simple stylesheet link tag, like: <link rel="Stylesheet" type="text/css" href="%root_path%/style.css" />, this PR support to vimwiki_markdown to replace root_path in the template

patrickdavey commented 7 years ago

I'm happy enough to merge this, however, why don't you just add whatever you want into the template as a hard coded link? The root_path (as far as my understanding is) will be replaced each time the markdown -> html happens. For example, if you have a wiki with subdirectories, the root_path will be passed in as ../../ etc. For something like a stylesheet, why wouldn't you want to just have it relative to the root of your website (or wherever) rather than relative per html file.

For example, here is my template file ?

Anyway, happy to add it. However, would you be able to

  1. Update the readme (so that others can find out about it)
  2. If you feel like adding a test, that'd be awesome! just so that the functionality doesn't get broken in the future.
okayzed commented 7 years ago

the %root_path% is used in vimwiki. its particularly useful for me because i am loading the output via local file browsing (and not over http). hardcoding a style link to a location on disk is fine, but not portable.

i added a test as well (see 4233cbc), but nothing to the README (i leave that up to you)

patrickdavey commented 7 years ago

Cool - will merge and push up a new version shortly :)

Thanks!