I wanted an easy way to preview Markdown documents while writing them. I came across grip
(that uses GitHub for styles) and also vim-markdown-preview
. I combined features from grip
with the parts I liked with vim-markdown-preview
and the result is this plugin.
Other from that, I also added to possibility to convert a Markdown document to PDF using markdown-pdf
. Thanks to the CSS from github-markdown-css
the result is quite like how it would've been rendered on GitHub.
- With Pathogen: Place
vim-markdown-grip/
in.vim/bundle/
. - With Vundle:
- Add
Plugin 'mgor/vim-markdown-grip'
to your.vimrc
. - Launch
vim
and run:PluginInstall
- Add
By default, when opening and saving a .markdown
or .md
file, grip
will automatically start and open the preview in your default browser. When you close the opened file, grip
will be stopped. However you'd have to close the preview manually in your browser.
To get around the GitHub API request limit (for un-authenticated usage), it is highly recommended that you generate an access token for GitHub and creates ~/.grip/settings.py
:
PASSWORD = '<access token>'
Convert your markdown document to a PDF by pressing Ctrl + m + p. This will generate a PDF document using markdown-pdf
with GitHub markdown styling.
Insert the notation <!-- toc -->
in your document where the table of contents should be placed. Press Ctrl + m + t to generate or update the ToC. This is done by using markdown-toc
.
-
grip:
sudo -H pip3 install grip
-
sudo npm install -g markdown-pdf
-
sudo npm install -g markdown-toc
-
sudo apt install wmctrl
This project was inspired by JamshedVesuna/vim-markdown-preview.
The CSS that is used by markdown-pdf
to replicate GitHub markdown style comes from sindresorhus/github-markdown-css.