A Neovim plugin renders markdown file in terminal buffer.
Only tested under Mac.
- Open terminal buffer in different direction:
vertical
,horizontal
. - Support auto refresh when file content changed.
- Support custom viewer command and args.
Any markdown viewer you like, such as:
$ brew install mdcat
$ brew install glow
$ brew install mdv
require("lazy").setup({
"topazape/md-preview.nvim",
ft = {"md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki"},
config = function()
require("md-preview").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the setup section below
}),
end
})
Following example:
local mp = require("md-preview")
mp.setup({
viewer = {
-- mdcat
exec = "mdcat",
exec_path = "",
args = { "--local" },
-- glow
-- exec = "glow",
-- exec_path = "",
-- args = { "-s", "dark" },
-- terminal markdown viewer
-- exec = "mdv",
-- exec_path = "",
-- args = { "-c", 80 },
},
-- 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"},
refresh = "r",
},
},
})
:MPToggle
: toggle markdown preview open or close.:MPOpen
: open markdown preview window.:MPClose
: close markdown preview window.:MPRefresh
: refresh markdown preview window.
MIT