Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/topazape/md-preview.nvim
A Neovim plugin renders markdown file in terminal buffer.
https://github.com/topazape/md-preview.nvim
markdown markdown-viewer neovim neovim-plugin
Last synced: about 6 hours ago
JSON representation
A Neovim plugin renders markdown file in terminal buffer.
- Host: GitHub
- URL: https://github.com/topazape/md-preview.nvim
- Owner: topazape
- License: mit
- Created: 2023-10-26T04:26:34.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-27T04:49:48.000Z (about 1 year ago)
- Last Synced: 2023-10-28T05:28:53.492Z (about 1 year ago)
- Topics: markdown, markdown-viewer, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 1.51 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# md-preview.nvim
A Neovim plugin renders markdown file in terminal buffer.
Only tested under Mac.
- mdcat
![mdcat](./assets/mdcat.png)
- glow
![glow](./assets/glow.png)
- terminal markdown viewer
![terminal markdown viewer](./assets/mdv.png)## Features
- Open terminal buffer in different direction: `vertical`, `horizontal`.
- Support auto refresh when file content changed.
- Support custom viewer command and args.## Requirements
Any markdown viewer you like, such as:### [mdcat](https://github.com/swsnr/mdcat)
```sh
$ brew install mdcat
```### [glow](https://github.com/charmbracelet/glow)
```sh
$ brew install glow
```### [terminal markdown viewer](https://github.com/axiros/terminal_markdown_viewer)
```sh
$ brew install mdv
```## Installation
[Lazy](https://github.com/folke/lazy.nvim)
```lua
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
})
```## Setup
Following example:
```lua
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",
},
},
})
```## Commands
- `:MPToggle`: toggle markdown preview open or close.
- `:MPOpen`: open markdown preview window.
- `:MPClose`: close markdown preview window.
- `:MPRefresh`: refresh markdown preview window.## Thanks
[markdown-preview.nvim](https://github.com/0x00-ketsu/markdown-preview.nvim)
## License
MIT