sponsor Vim development Vim logo Vim Book Ad

macdown.vim : Live preview markdown in Chrome using applescript

 script karma  Rating 12/3, Downloaded by 8860  Comments, bugs, improvements  Vim wiki

created by
qiming zhao
script type
# Macdown.vim

This project is hosted at https://github.com/chemzqm/macdown.vim

A simplified and flexible markdown preview for vim user on Mac.
Using applescript instead of a server to enhance the exprience of live preview.

You can get the style preview [here](https://chemzqm.me/static/sample.html)

## Features

* Works out of box, all dependencies are optional.
* Preview in Chrome with range and auto reload support.
* Auto close Chrome tab on buffer delete and vim exit.
* Async markdown parse.
* Tables, GFM enabled, code highlight and footnote enabled by default.
* Misaka parser support [smartypants](http://misaka.61924.nl/#misaka.smartypants),
toc (table of content) and unicode (including Emoji)

## Install

Take [vundle](https://github.com/VundleVim/Vundle.vim) as example:

    Plugin 'chemzqm/macdown.vim'

If you need async markdown parse, just install
[vimproc.vim](https: //github.com/Shougo/vimproc.vim)

    Plugin 'Shougo/vimproc.vim'

## Usage

To preview current markdown file, type:


Preview with range, eg:


Or visual select a range, and use:


To toggle auto preview for current file, type:


The corresponding chrome tab would be activated and refreshed on CursorHold and
BufWrite. A handy remap could be:

    nnoremap <C-p> :PreviewAuto<CR>

## Configuration

By default `macdown.vim` using [markit](https://github.com/lepture/markit) for
markdown parsing, it's exists inside this repository, but if you need speed and
more future, you can set global variable:

    let g:macdown_marked_programme = 'misaka'

To enable misaka parse, it's almost 4 times faster than markit, but you need to
install python dependencies:

    pip install misaka pygments

`sudo` might be required.

You can also make your own parser, it's just create a excutable file inside
`macdown.vim/bin` which accept markdown content from stdin and output html to


* Scrollbind for vim and Chrome
install details
NeoBundle 'chemzqm/macdown.vim'
Plugin 'chemzqm/macdown.vim'
Plug 'chemzqm/macdown.vim'
|vimproc| is requried to do the async markdown parse job, it would be
installed via |vim-plug|:

Plug 'Shougo/vimproc.vim',{'do', 'yes\\|make'}

Follow the installation guide of |vimproc| if you got problem during

If you want to use misaka https://github.com/FSX/misaka for markdown parse, you have to install python dependencies by:

        pip install misaka pygments

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
macdown.zip 0.1.0 2016-01-21 7.0 qiming zhao Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.