• Stars
    star
    100
  • Rank 333,455 (Top 7 %)
  • Language
    CSS
  • License
    GNU General Publi...
  • Created about 6 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Markdown preview for neovim using pandoc and live-server

nvim-markdown-preview

Markdown preview in the browser using pandoc and live-server through Neovim's job-control API.

Usage

Open a markdown file in vim and run :MarkdownPreview. The preview opens in a new browser tab which will be reloaded whenever you :write the buffer. If you accidentally close your browser tab or want to change the theme just run the command again. The file needs to be written to disk before you can start the preview.

Features

  • Asynchronous
  • Produces "standalone" html files (injected css)
  • Custom themes (github, solarized-dark, solarized-light)
  • Auto-reloads browser tab on save
  • Serves assets from the current working directory (embed pictures in your markdown etc.)
  • Custom markdown input formats
  • KaTeX for formatting LaTeX math
  • Syntax highlighting from the Kate Editor themes

Requirements

  • pandoc
  • live-server (Node.js)

pandoc and live-server executables should be installed and accessible in your $PATH.

Pandoc

Pandoc should be available in most Linux distributions and on macOS via brew and Windows via chocolatey.

On macOS using Homebrew:

brew install pandoc

For Linux:

  • Ubuntu sudo apt install pandoc

  • Fedora sudo dnf install pandoc

For Windows:

Either download the executable or get it with Chocolatey

choco install pandoc

For other systems please see the links in the description on how to install.

live-server

Assuming you have Node.js installed:

npm install -g @compodoc/live-server

See this issue on why the live-server fork is preferred.

Installation

If you are using vim-plug

Plug 'davidgranstrom/nvim-markdown-preview'

source the file (:source %) (or restart vim) and then run :PlugInstall

Documentation

Usage

There is only a single command:

:MarkdownPreview [theme]    Starts the browser preview of the current file.
                            Optional argument to select a theme.

                            The available themes are currently:
                            * github
                            * solarized-light
                            * solarized-dark

Customization

Set this variable in your init.vim to specify a default theme for the preview. The default is the GitHub theme.

let g:nvim_markdown_preview_theme = 'solarized-light'

Set this variable to specify the pandoc input format (--format/-f) option. The default is gfm (GitHub flavored markdown).

let g:nvim_markdown_preview_format = 'markdown'

Take a look at :help nvim-markdown-preview for complete documentation and examples.

Screenshots

Q & A

Q: Why doesn't the preview update in real-time while I type in vim?

A: This plugin simply doesn't work like that. It only aims to provide some live update capabilities around what is essentially :w !pandoc % -o /tmp/file.html

Q: I want the preview tab to open automatically without typing :MarkdownPreview

A: Sure, use an autocmd like:

autocmd FileType markdown MarkdownPreview

Or the <Plug> mapping to bind it to the key of your choice

nmap <cr> <plug>(nvim-markdown-preview)

TODO

The markdown file must be written to disk first. It should be possible to use Pandoc stdin and pipe the buffer content using jobsend() instead.

License

GPL v3

nvim-markdown-preview
Copyright (C) 2018 David Granström

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

More Repositories

1

scnvim

Neovim frontend for SuperCollider.
Lua
146
star
2

NanoKontrol2

SuperCollider interface for NanoKONTROL2
SuperCollider
16
star
3

osc.nvim

Open Sound Control for Neovim
Lua
12
star
4

losc

Open Sound Control (OSC) for lua/luajit
Lua
12
star
5

telescope-scdoc.nvim

A SuperCollider documentation picker.
Lua
9
star
6

Pxshuf

Sequentially embed values from a list in a random order with no repetitions
SuperCollider
7
star
7

EZConv

Wrapper class around PartConv
SuperCollider
6
star
8

scnvim-tmux

Redirect post window ouput to a tmux pane.
Lua
6
star
9

Volca

Control Korg Volca synths from SuperCollider
Scala
4
star
10

scnvim-logger

Example scnvim extension
Lua
4
star
11

sclang-lsp-stdio

A stdio wrapper for LanguageServer.quark
JavaScript
4
star
12

oblique-strategies.nvim

Oblique Strategies
Lua
4
star
13

ArturiaBeatStep

Interface for Arturia BeatStep in SuperCollider
SuperCollider
4
star
14

json-to-midi

json to midi file generator
C++
4
star
15

slow

Like cat, but slower
C
2
star
16

audio-feature-extraction

Batch audio file analysis of spectral features
Python
2
star
17

SuperPrism

High-density speaker array diffusion engine
SuperCollider
2
star
18

tidal-bootstrap-deprecated

Deprecated - This project has been transferred to the TidalCycles organization
1
star
19

MessagePack

MessagePack implementation in SuperCollider
SuperCollider
1
star
20

SCDocVimRenderer

SCDoc render for vim
SuperCollider
1
star
21

7-limit-modulations

Generative audio visual installation
HTML
1
star
22

MS20Ctl

Interface for Korg MS-20 MIDI controller
SuperCollider
1
star
23

xchn-presenter

JavaScript
1
star
24

ixx

piece for laptop ensemble
SuperCollider
1
star
25

scnvim-wiki

Mirror of the scnvim wiki
1
star
26

scvim-reload

Reload (re-evaluate) SuperCollider projects in vim
Vim Script
1
star
27

xchn-browser-ui

JavaScript
1
star