~dricottone/vim-markdown-preview

83efd46cde61af369796e15895eb6e4223a2a850 — Jamshed Vesuna 9 years ago 1135b27 + 5ab8e9a
Merge pull request #11 from oshybystyi/support-for-github-flavoured-md

Added support for github flavoured markdown
2 files changed, 17 insertions(+), 3 deletions(-)

M README.md
M plugin/vim-markdown-preview.vim
M README.md => README.md +10 -2
@@ 26,6 26,8 @@ Installation<a name='installation'></a>
        * `let vim_markdown_preview_toggle=2`
    * To disregard images and still automatically preview on buffer write, add:
        * `let vim_markdown_preview_toggle=3`
5. If you prefer github flavoured markdown you need to install grip (tested only on ubuntu) and set next option:
    * `let vim_markdown_preview_github=1`

The following example is using the write buffer option on OS X, with displaying images in the markdown preview, adding the following to `.vimrc`:



@@ 46,9 48,9 @@ Support and Requirements

## Unix:

* [Markdown](http://daringfireball.net/projects/markdown/)
* [Markdown](http://daringfireball.net/projects/markdown/) or [grip](https://github.com/joeyespo/grip) if you want to parse github flavoured markdown
* [xdotool](https://github.com/jordansissel/xdotool)
* [Google Chrome](https://www.google.com/chrome/browser/)
* [Google Chrome](https://www.google.com/chrome/browser/) or [other browser](https://github.com/JamshedVesuna/vim-markdown-preview/wiki/Use-other-browser-to-preview-markdown#ubuntu-or-debian)

Usage
=====


@@ 70,3 72,9 @@ Behind The Scenes
    1. First, vim-markdown-preview renders your markdown as html with the filename `<your-file>.md.html` in the same directory.
    2. Next, vim-markdown-preview either opens the html file or refreshes the Google Chrome or Safari tab.
    3. There is currently no option to remove this file after previewing.

Know issues
===========
* If you've chosen to use github flavoured markdown (with grip), there might some issues:
    * necessity to use [access token](https://github.com/joeyespo/grip#access) (a solution is to set `alias grip="grip --user <your-username> --pass <your-pass>` in your ***.bashrc/.zshrc***).
    * if github is unresponsive you wont be able to render your file.

M plugin/vim-markdown-preview.vim => plugin/vim-markdown-preview.vim +7 -1
@@ 6,6 6,7 @@
let b:vim_markdown_preview_browser = get(g:, 'vim_markdown_preview_browser', 'Google Chrome')
let b:vim_markdown_preview_temp_file = get(g:, 'vim_markdown_preview_temp_file', 0)
let b:vim_markdown_preview_toggle = get(g:, 'vim_markdown_preview_toggle', 0)
let b:vim_markdown_preview_github = get(g:, 'vim_markdown_preview_github', 0)

function! Vim_Markdown_Preview()



@@ 23,7 24,12 @@ function! Vim_Markdown_Preview()
  endif

  let curr_file = expand('%:p')
  call system('markdown ' . curr_file . ' > /tmp/vim-markdown-preview.html')

  if b:vim_markdown_preview_github == 1
    call system('grip ' . curr_file . ' --export /tmp/vim-markdown-preview.html')
  else
    call system('markdown ' . curr_file . ' > /tmp/vim-markdown-preview.html')
  endif

  if OSNAME == 'unix'
    let chrome_wid = system("xdotool search --name 'vim-markdown-preview.html - " . b:vim_markdown_preview_browser . "'")