*markdown-preview* real-time markdown preview

Author:  iamcco <ooiss@qq.com>
Version: 0.0.1

1. English                                             |mkdp-introduction-en|
2. 中文                                                |mkdp-introduction-zh|

Introduction                                           *mkdp-introduction-en*

Use the markdown-preview.vim plugin you can preview markdown on real-time
through a browser
(this plugin need your vim support py2/py3 features)

Usage

Command：

    MarkdownPreview
    " open preview window in markdown buffer

    MarkdownPreviewStop
    " close the preview window and server

    (when MarkdownPreview command can't open preview window, you can use the
    MarkdownPreviewStop command before using MarkdownPreview command)

Defaul Setting:

    g:mkdp_path_to_chrome = ""
    " path to the chrome or the command to open chrome
    " if set, g:mkdp_browserfunc would be ignored

    let g:mkdp_browserfunc = 'MKDP_browserfunc_default'
    " callback vim function to open browser, the only param is the url to open

    g:mkdp_auto_start = 0
    " set to 1, the vim will open the preview window once enter the markdown
    buffer

    g:mkdp_auto_open = 0
    " set to 1, the vim will auto open preview window when you edit the
    markdown file

    g:mkdp_auto_close = 1
    " set to 1, the vim will auto close current preview window when change
    from markdown buffer to another buffer

    g:mkdp_refresh_slow = 0
    " set to 1, the vim will just refresh markdown when save the buffer or
    leave from insert mode, default 0 is auto refresh markdown as you edit or
    move the cursor

    let g:mkdp_command_for_global = 0
    " set to 1, the MarkdownPreview command can be use for all files,
    " by default it just can be use in markdown file

    let g:mkdp_open_to_the_world = 0
    " set to 1, server available to others in your network
    " by default, the server only listens on localhost


Key Mapping:

By default this Plugin has no mapping, if you want to has your own mapping
you can map the keys to <Plug>MarkdownPreview for opening markdown preview window and
map keys to <Plug>StopMarkdownPreview for closing the preview window

Examples for mapping the F8 key to open markdown preview window and F9 key to
close preview window:
    " for normal mode
    nmap <silent> <F8> <Plug>MarkdownPreview
    " for insert mode
    imap <silent> <F8> <Plug>MarkdownPreview
    " for normal mode
    nmap <silent> <F9> <Plug>StopMarkdownPreview
    " for insert mode
    imap <silent> <F9> <Plug>StopMarkdownPreview

FAQ:

Q: the firefox preview window didn't close when leave the markdown file in vim

A: if you want the plugin auto close the preview window on firefox, you have to do some config:

1. open firefox
2. type `about:config` in the address bar and press Enter key
3. search `dom.allow_scripts_to_close_windows` item and set the value to `true`

> you have to know what will happend when you do the config above

================================================================================

说明                                                   *mkdp-introduction-zh*

使用 markdown-preview.vim 插件可以实时通过浏览器预览 markdown 文件
（使用该插件需要 vim 支持py2/py3)

使用和设置

命令：

    MarkdownPreview
    " 在打开 markdown 文件后，使用该命令可以打开预览窗口

    MarkdownPreviewStop
    " 关闭 markdown 预览窗口，并停止开启的服务进程

    （在 MarkdownPreview 命令无效的情况下，可以先 MarkdownPreviewStop 再
    MarkdownPreview）

默认配置：

    g:mkdp_path_to_chrome = ""
    " 设置 chrome 浏览器的路径（或是启动 chrome 的命令）
    " 如果设置了该参数, g:mkdp_browserfunc 将被忽略

    let g:mkdp_browserfunc = 'MKDP_browserfunc_default'
    " vim 回调函数, 参数为要打开的 url

    g:mkdp_auto_start = 0
    " 设置为 1 可以在打开 markdown 文件的时候自动打开浏览器预览，只在打开
    markdown 文件的时候打开一次

    g:mkdp_auto_open = 0
    " 设置为 1 在编辑 markdown 的时候检查预览窗口是否已经打开，否则自动打开预
    览窗口

    g:mkdp_auto_close = 1
    " 在切换 buffer 的时候自动关闭预览窗口，设置为 0 则在切换 buffer 的时候不
    自动关闭预览窗口

    g:mkdp_refresh_slow = 0
    " 设置为 1 则只有在保存文件，或退出插入模式的时候更新预览，默认为 0，实时
    更新预览

    let g:mkdp_command_for_global = 0
    " 设置为 1 则所有文件都可以使用 MarkdownPreview 进行预览，默认只有 markdown
    " 文件可以使用改命令

    let g:mkdp_open_to_the_world = 0
    " 设置为 1, 在使用的网络中的其他计算机也能访问预览页面
    " 默认只监听本地（127.0.0.1），其他计算机不能访问

键位绑定：

默认情况下，插件没有进行任何的按键绑定，如果想绑定按键去预览 markdown 文件，可以绑定
按键到 <Plug>MarkdownPreview 来打开预览窗口，绑定按键到 <Plug>StopMarkdownPreview 来
关闭预览窗口。

按键绑定例子（F8打开预览窗口，F9关闭预览窗口）：

    nmap <silent> <F8> <Plug>MarkdownPreview        " 普通模式
    imap <silent> <F8> <Plug>MarkdownPreview        " 插入模式
    nmap <silent> <F9> <Plug>StopMarkdownPreview    " 普通模式
    imap <silent> <F9> <Plug>StopMarkdownPreview    " 插入模式

FAQ:

Q: 在火狐浏览器中，预览页面不能自动关闭

A: 如果需要在火狐浏览器中启用自动关闭预览窗口，需要相关设置：

1. 打开火狐浏览器
2. 地址栏敲入 `about:config` 然后回车
3. 搜索 `dom.allow_scripts_to_close_windows` 选项，并设置 value 为 `true`

> 如果你打算设置上面的配置，你应该知道该配置会产生什么影响
