https://github.com/andev0x/mdview.nvim
A simple Neovim plugin for previewing Markdown files in a floating window or your browser, with live updates and scroll synchronization
https://github.com/andev0x/mdview.nvim
lazyvim markdown nvim-plugin opensource packer preview
Last synced: about 2 months ago
JSON representation
A simple Neovim plugin for previewing Markdown files in a floating window or your browser, with live updates and scroll synchronization
- Host: GitHub
- URL: https://github.com/andev0x/mdview.nvim
- Owner: andev0x
- License: mit
- Created: 2025-08-11T02:46:19.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-29T09:47:18.000Z (9 months ago)
- Last Synced: 2025-08-29T13:18:57.917Z (9 months ago)
- Topics: lazyvim, markdown, nvim-plugin, opensource, packer, preview
- Language: Lua
- Homepage:
- Size: 45.9 KB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
mdview.nvim
----
A simple Neovim plugin for previewing Markdown files in a floating window or your browser, with live updates and scroll synchronization.
## Features
- Live preview of Markdown files.
- Scroll synchronization between Neovim and the browser.
- Floating window preview inside Neovim using `w3m`.
- Open the preview in your default browser.
- Dark mode support (toggled with the `t` key).
- Yank the rendered HTML to the clipboard.
## Demo
"
## Dependencies
- `node`
- `pandoc`
- `w3m` (for the floating window preview)
- `curl`
## Installation
Using `packer.nvim`:
```lua
use {
'andev0x/mdview.nvim',
run = 'npm install',
}
```
Using `lazy.nvim`:
```lua
{
'andev0x/mdview.nvim',
build = 'npm install',
config = function()
require('mdview').setup()
end,
}
```
## Usage
- `:MDView` - Start the preview for the current Markdown file.
- `:MDStop` - Stop the preview.
The preview will open in a floating window. You can also open it in your browser by pressing `o` in the preview window.
### Keymaps (in the preview window)
- `q` - Close the preview window.
- `o` - Open the preview in your default browser.
- `t` - Toggle between light and dark themes.
- `y` - Yank the rendered HTML to the system clipboard.
## Configuration
You can configure the plugin by passing a setup function to the `setup` method.
```lua
require('mdview').setup({
-- The port to use for the web server.
port = 8080,
-- The host to use for the web server.
host = '127.0.0.1',
-- The template to use for the HTML output.
-- You can use the following placeholders:
-- - `{{title}}` - The title of the document.
-- - `{{body}}` - The body of the document.
-- - `{{theme}}` - The theme of the document (light or dark).
-- - `{{ws_address}}` - The address of the WebSocket server.
template = '...',
-- The dark theme template.
template_dark = '...',
-- The command to use for opening the browser.
browser_cmd = 'xdg-open',
-- The command to use for yanking the HTML to the clipboard.
yank_cmd = 'xclip -selection clipboard',
})
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## License
[MIT](LICENSE)