From c267c36be1e827535bb6244c7eb1f5340bc25b26 Mon Sep 17 00:00:00 2001 From: Jeremy Bi Date: Wed, 1 Jun 2016 13:53:06 +0800 Subject: [PATCH] Add vmd support in markdown mode --- layers/+lang/markdown/README.org | 5 +++++ layers/+lang/markdown/packages.el | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/layers/+lang/markdown/README.org b/layers/+lang/markdown/README.org index d820136a8..fb0acad68 100644 --- a/layers/+lang/markdown/README.org +++ b/layers/+lang/markdown/README.org @@ -25,6 +25,7 @@ This layer adds markdown support to Spacemacs. ** Features: - markdown files support via [[http://jblevins.org/git/markdown-mode.git/][markdown-mode]] +- Fast Github-flavored live preview via [[https://github.com/blak3mill3r/vmd-mode][vmd-mode]] - TOC generation via [[https://github.com/ardumont/markdown-toc][markdown-toc]] - Completion of Emojis using [[https://github.com/dunn/company-emoji][company-emoji]] (still needs a way of showing, either using the =emoji= layer or having a proper font) :clap: @@ -38,6 +39,9 @@ To use this configuration layer, add it to your =~/.spacemacs=. You will need to add =markdown= to the existing =dotspacemacs-configuration-layers= list in this file. +To enable Github-flavored live preview, you will need to install the executable +with =npm install -g vmd=. + * Usage To generate a table of contents type on top of the buffer: ~SPC SPC markdown-toc/generate-toc RET~ @@ -117,6 +121,7 @@ To generate a table of contents type on top of the buffer: | ~SPC m c m~ | other window | | ~SPC m c p~ | preview | | ~SPC m c P~ | live preview in Emacs' built-in browser | +| ~SPC m c d~ | Github-flavored live preview | | ~SPC m c e~ | export | | ~SPC m c v~ | export and preview | | ~SPC m c o~ | open | diff --git a/layers/+lang/markdown/packages.el b/layers/+lang/markdown/packages.el index 32454cb2a..e9ae712e2 100644 --- a/layers/+lang/markdown/packages.el +++ b/layers/+lang/markdown/packages.el @@ -19,6 +19,7 @@ markdown-toc mmm-mode smartparens + vmd-mode )) (defun markdown/post-init-company () @@ -216,3 +217,13 @@ Will work on both org-mode and any mode that accepts plain html." (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-javascript) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-ess) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-rust)))) + +(defun markdown/init-vmd-mode () + (use-package vmd-mode + :if (executable-find "vmd") + :defer t + :init + (progn + (spacemacs/set-leader-keys-for-major-mode 'markdown-mode + ;; Github-flavored live preview in a separate window + "cd" 'vmd-mode))))