Skip to content

0x00-ketsu/markdown-preview.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

markdown-preview

A Neovim plugin renders markdown file in terminal buffer.

This plugin relies on Glow, only work under Linux or Mac.

markdown-preview.mp4

Features

  • Open terminal buffer in different direction: vertical, horizontal.
  • Support auto refresh when file content changed.

Requirements

Installation

Packer

-- Lua
use {
  '0x00-ketsu/markdown-preview.nvim',
  ft = {'md', 'markdown', 'mkd', 'mkdn', 'mdwn', 'mdown', 'mdtxt', 'mdtext', 'rmd', 'wiki'},
  config = function()
    require('markdown-preview').setup {
      -- your configuration comes here
      -- or leave it empty to use the default settings
      -- refer to the setup section below
    },
  end
}

Lazy

-- Lua
require('lazy').setup({
  '0x00-ketsu/markdown-preview.nvim',
  ft = {'md', 'markdown', 'mkd', 'mkdn', 'mdwn', 'mdown', 'mdtxt', 'mdtext', 'rmd', 'wiki'},
  config = function()
    require('markdown-preview').setup {
      -- your configuration comes here
      -- or leave it empty to use the default settings
      -- refer to the setup section below
    },
  end
})

Setup

Following defaults:

local mp = require('markdown-preview')
mp.setup(
    {
      glow = {
        -- When find executable path of `glow` failed (from PATH), use this value instead
        exec_path = '',
        style = '', -- Path to glamour JSON style file
      },
      -- Markdown preview term
      term = {
        -- reload term when rendered markdown file changed
        reload = {
          enable = true,
          events = {'InsertLeave', 'TextChanged'},
        },
        direction = 'vertical', -- choices: vertical / horizontal
        keys = {
        close = {'q', '<Esc>'},
        refresh = 'r',
        }
      }
    }
)

Commands

  • :MPToggle: toggle markdown preview open or close.
  • :MPOpen: open markdown preview window.
  • :MPClose: close markdown preview window.
  • :MPRefresh: refresh markdown preview window.

Thanks

glow.nvim

License

MIT

Releases

No releases published

Packages

No packages published