Giter VIP home page Giter VIP logo

vmd-mode's Introduction

vmd-mode.el

Fast Github-flavored Markdown previews synchronized with changes to an emacs buffer (no need to save).

Dependencies

Clone this repo, and (require 'vmd-mode) or (use-package vmd-mode)

Why write a new Markdown preview package?

I wanted a better one for my own needs.

  • It's fast

In my experience, it's no problem to have pretty gigantic Markdown files (thousands of lines) and the thing stays responsive. vmd is using node's fsnotify to watch that temp file, and emacs is writing that temp file in the buffer's after-change-functions. This is always going to be faster than any websocket-based implementation, and I find this makes editing documentation more fun, which increases the likelyhood that I will document things, and generally leads to Good Times.

  • and mimics Github's markdown rendering :suspect: ๐Ÿ‘ โค๏ธ

so far, so good...

Video of the functionality

A brief video that shows what this minor mode does

https://www.youtube.com/watch?v=-mb9_501Ipo&feature=youtu.be

Usage

With a markdown file open in a buffer, just call (vmd-mode).

                                         ;; You could also
(global-set-key (kbd "M-m p") 'vmd-mode) ;; make a global binding for that,
(add-hook 'markdown-mode-hook 'vmd-mode) ;; or add a hook...

Multiple Markdown buffers can be previewed simultaneously; each will have its own preview window.

Completion

If you use company-mode completion, you can configure it to complete Github's emoji mnemonics like this:

(require 'cl-lib)
(require 'company)

(defun vmd-company-backend (command &optional arg &rest ignored)
  (interactive (list 'interactive))

  (cl-case command
    (interactive (company-begin-backend 'company-sample-backend))
    (prefix (and (eq major-mode 'fundamental-mode)
                 (company-grab-symbol)))
    (candidates
     (cl-remove-if-not
      (lambda (c) (string-prefix-p arg c))
      vmd-mode/github-emojis-list))))

(add-to-list 'company-backends 'vmd-company-backend)

Limitations:

  • The limitations of vmd
  • It's probably terrible elisp (please help make it better! ๐Ÿ˜„).

License: MIT

Author: Blake Miller

๐Ÿ˜„ criticism & PRs are welcome ๐Ÿ˜„

vmd-mode's People

Contributors

aiguofer avatar blak3mill3r avatar blrsn avatar enisozgen avatar geo7 avatar kaushalmodi avatar pierre-rouleau avatar purcell avatar xiongtx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vmd-mode's Issues

remote tramp files do not work (to preview)

I recently found vmd-mode and it is very useful. I have encountered an issue when using TRAMP to edit a file on a remote machine and wanting to use vmd-mode for previewing.

In current code, the tempfile gets created in same directory as original file, concatenating the string .temp
setq vmd-copy-file

This works great for local edits on local machine. Unfortunately, for files edited using TRAMP session, e.g. on a remote machine, the .temp file is also placed on the remote machine, and the vmd process does not know how to get to the file. The .temp file gets updated appropriately, but it is not available on local machine to preview.

I think a possible way around this issue could be to provide an alternate way to name a tempfile? It would then be able to have a local alternate path and, e.g.the local platform tempfile area (referring to something like /tmp or %TEMP%) could be used? That would not be perfect, but it would allow the preview of the markdown text to happen in the remote TRAMP session case.

Unable to use it on Mac

Hi,

It is a really nice piece of integration here! But unfortunately I am unable to run it on my Mac cuz as soon as I enter vmd-mode Electron will crash.

Any idea how I might be able to fix this?

Under markdown layer, live preview does not work

When using markdown layer, I followed the instruction and set layer

(markdown :variables markdown-live-preview-engine 'vmd-mode)

However, typing spc-m-c-P which should allow live preview using engine defined with layer variable markdown-live-preview-enginewill will actually leads to a safari window saying /bin/bash: markdown: command not found.
I have already npm installed vmd and it can work properly independently. I wonder why this is not calling vmd to render the .md file and what shall I do to make it work properly.

No such file or directory resources/emojis

Hello,

Thanks for this cool extension.

Not sure if I'm doing something wrong, using spacemacs on Arch Linux with the markdown layer, I get this error when I try enable vmd-mode:

byte-code: Opening input file: No such file or directory, /home/admin/git/fnb/my-wiki/something/resources/emojis [2 times]

vmd-mode fails to load.

I then do something like this:

mkdir /home/admin/git/fnb/my-wiki/something/resources/
touch /home/admin/git/fnb/my-wiki/something/resources/emojis

Then I can enable vmd-mode. Shouldn't the above not be required?

melpa install does not include the emojis completions

If vmd-mode is installed via package-install vmd-mode, the emoji completion list seems to be missing.

in vmd-mode.el saw this

(defvar vmd-mode--emojis-file "./resources/emojis"

but the resources/ directory seems to be missing, the ELPA install area only containing these files:

  -rw-r--r--   1 user staff   659 Jun 18 07:21 vmd-mode-autoloads.el
  -rw-r--r--   1 user staff   301 Jun 18 07:21 vmd-mode-pkg.el
  -rw-r--r--   1 user staff  3831 Jun 18 07:21 vmd-mode.el
  -rw-r--r--   1 user staff  5069 Jun 18 07:21 vmd-mode.elc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.