The markdown file must be written to disk first. Or the mapping to bind it to the key of your choice nmap (nvim-markdown-preview) Q: I want the preview tab to open automatically without typing :MarkdownPreviewĪ: Sure, use an autocmd like: autocmd FileType markdown MarkdownPreview It only aims to provide some live update capabilities around what is essentially :w !pandoc % -o /tmp/file.html Q: Why doesn't the preview update in real-time while I type in vim?Ī: This plugin simply doesn't work like that. Take a look at :help nvim-markdown-preview for complete documentation and examples. let g:nvim_markdown_preview_format = 'markdown' The default is gfm (GitHub flavored markdown). Set this variable to specify the pandoc input format (-format/-f) option. let g:nvim_markdown_preview_theme = 'solarized-light' Set this variable in your init.vim to specify a default theme for the preview. There is only a single command: :MarkdownPreview Starts the browser preview of the current file. Source the file ( :source %) (or restart vim) and then run :PlugInstall Documentation Usage Plug 'davidgranstrom/nvim-markdown-preview' Or if you prefer yarn yarn global add live-server
Macos markdown preview install#
live-serverĪssuming you have Node.js installed: npm install -g live-server
Macos markdown preview how to#
On macOS using Homebrew: brew install pandocĮither download the executable or get it with Chocolatey choco install pandocįor other systems please see the links in the description on how to install. Pandoc should be available in most Linux distributions and on macOS via brew and Windows via chocolatey. Pandoc and live-server executables should be installed and accessible in your $PATH. Syntax highlighting from the Kate Editor themes.Serves assets from the current working directory (embed pictures in your markdown etc.).Custom themes ( github, solarized-dark, solarized-light).Produces "standalone" html files (injected css).The file needs to be written to disk before you can start the preview. If you accidentally close your browser tab or want to change the theme just run the command again. The preview opens in a new browser tab which will be reloaded whenever you :write the buffer.
Open a markdown file in vim and run :MarkdownPreview. Markdown preview in the browser using pandoc and live-server through Neovim's job-control API.