Yet another vim markdown preview plugin. Not suitable for Windows.
- CommonMark Syntax Support
- It's easy to install with vundle or bundle
- No complex config steps
- Code Hightlight
- Easy to custom your own css style
- Code custom style hightlight(using hightlight.js)
- Now support flowcharts feature! (based on mermaid, should read the doc first)
You may install some libraries first:
(sudo) pip install future
(sudo) pip install mistune
Recommend Bundle or Vundle
- you can see how to install vundle here
- after you install your vundle, make sure your plugins folder is ~/.vim/bundle
- then you can write this plugin url into your .vimrc file, like Plugin 'D0n9X1n/markdown-preview.vim'
- then use PluginInstall to install the plugin
- this is not a good choice, make sure every step is right
- use cd ~/.vim into your vim folder
- use git clone https://github.com/D0n9X1n/markdown-preview.vim.git .
- use mv markdown-preview.vim/ . && rm -rf markdown-preview.vim*
- use **cp -r resources MarkDownRes ** to copy the resources
- then you can open your vim and type :MarkdownPreview Github to check whether it is ok
You can see example document here TEST.md
If your plugin folder is not .vim/bundle
, you should config it first, by adding these into your .vimrc file:
Like:
" markdown-preview.vim {{{
let g:PluginDir = '/Users/Mike/.vim/bundle/markdown-preview.vim'
" }}}
- g:PluginDir is where your markdown-preview.vim plugin is.
- edit your markdown doc normally
- when you want to preview it in html you just use :MarkdownPreview default to show your doc in your browser
- if you want to change your style. you just use :MarkdownPreview GitHub in github style markdown view
- you can also use the following code to your vimrc file to bind key maps.
map <leader>m :MarkdownPreview GitHub<CR>
- use :MarkdownPreviewWithCustomCodeStyle css-style code-style instead
- you can use custom css style and code hightlight style
- the following are code styles you can use:
- github
- solarized_dark
- solarized_light
- default
- color-brewer
- railscasts
- tomorrow
- zenburn
- mono
- monokai_sublime
- these code css files are in your ~/.vim/MarkDownRes/code-styles folder
- for example, when you use :MarkdownPreviewWithCustomCodeStyle GitHub zenburn, when edit the TEST.md
I don't recommand you to use this feature due to many websites or editors not supporting this feature which may confuse you. However, if you want to use the flowcharts feature, you must add the type when you writing flowcharts, for example, when you write, you should add keyword chart or mermaid to the code block as below:
Then when you use MarkdownPreview github
, you can see the result as below:
This theme is in the css folder, if you want to change it to your favorite theme. follow the steps:
- go into your markdown-preview.vim folder
- find resources folder and you will find default.css and github.css here
- add your custom css file here, such as example.css
- use vim open your markdown doc and :MarkdownPreview example
- and you will see your doc preview in your browser with example.css
See @TODO.md
Wish you have a nice day
See @LICENSE