Skip to content

instant-markdown/instant-markdown.nvim

Repository files navigation

instant-markdown.nvim

Instantly preview markdown files in a browser window as you type. This plugin is a Neovim-first (and possibly Vim compatible) Lua port of the vim-instant-markdown Plugin.

Installation

Quick start (assuming you have all the necessary dependencies):

  • Install Node.js

  • Install the mini-server by running either:

    • [sudo] npm -g install instant-markdown-d

    or the following command for the Python mini-server (which also requires [pandoc][pandoc] to render markdown):

    • pip install --user smdv
  • Add the following to your .vimrc, depending on the plugin manager of your choice:

    • lazy.nvim

      -- in init.lua 
      -- within require("lazy").setup({ 
          {
              'instant-markdown/instant-markdown.nvim',
              dependencies = { 'nvim-lua/plenary.nvim' }
          }
    • TODO: other package managers.

Configuration

Overriding default configuration with lazy.nvim:

{
    'instant-markdown/instant-markdown.nvim',
    dependencies = { 'nvim-lua/plenary.nvim' },
    opts = {
        mathjax = true,
        mermaid = true,
    }
}

Features

  • Slow mode (render only on save)
  • Autostart preview when markdown files are opened
  • Mathjax for equations
  • Mermaid.js for charts
  • Autoscroll when going into insert mode
  • Light and dark themes

Development

Run tests

Running tests requires plenary.nvim to be checked out in the parent directory of this repository. You can then run:

nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal.vim'}"

Or if you want to run a single test file:

nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/path_to_file.lua {minimal_init = 'tests/minimal.vim'}"

About

Instant Markdown previews from Neovim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published