Markdown Rendering in Neovim
Markdown Rendering in Neovim
Neovim can render markdown with formatted tables, headings, and styling - similar to Obsidian's reading mode.
Current Setup: markdown-preview.nvim
What you have installed:
- Plugin:
iamcco/markdown-preview.nvim - Opens rendered markdown in web browser
- Full HTML rendering with live reload
How to use:
vim:MarkdownPreview
Or use the keybind (in markdown files):
- Press
<leader>cpto toggle preview
Pros:
- Full-featured HTML rendering
- Live updates as you type
- Supports complex markdown features
- Renders exactly like published content
Cons:
- Opens in separate browser window (not in-editor)
- Requires switching between editor and browser
- Not ideal for quick table viewing
Better Option: render-markdown.nvim
For Obsidian-like in-editor rendering:
Install MeanderingProgrammer/render-markdown.nvim - renders markdown directly in Neovim buffer:
Features:
- Tables render as formatted tables (like Obsidian)
- Headings display with proper sizing/styling
- Code blocks with syntax highlighting
- Checkboxes render as actual checkboxes
- Conceals markdown syntax characters
- No external browser needed
Installation (LazyVim):
Create ~/.config/nvim/lua/plugins/render-markdown.lua:
luareturn { { "MeanderingProgrammer/render-markdown.nvim", opts = {}, dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons", }, ft = { "markdown" }, }, }
Then restart Neovim or run :Lazy sync
Usage:
- Auto-renders when opening
.mdfiles - Toggle rendering:
:RenderMarkdown toggle - Enable:
:RenderMarkdown enable - Disable:
:RenderMarkdown disable
Comparison
| Feature | markdown-preview.nvim | render-markdown.nvim |
|---|---|---|
| Rendering location | Browser | In-editor buffer |
| Table rendering | HTML | Unicode box drawing |
| Live preview | Yes | Yes |
| Switch windows | Required | Not needed |
| Complex markdown | Full HTML support | Basic formatting |
| Obsidian-like | No | Yes |
Recommended Workflow
Use both plugins for different purposes:
-
Daily editing with render-markdown.nvim:
- Quick table viewing
- Formatted headings
- In-editor rendering
- No context switching
-
Final preview with markdown-preview.nvim:
- Check published appearance
- Verify complex markdown
- Share preview with others
Example: Table Rendering
Source markdown:
markdown| Key | Function | Details | |-----|----------|---------| | `z` | Zoxide jump | Opens picker | | `Z` | fzf search | Recursive search |
With render-markdown.nvim (in Neovim buffer):
╭─────┬──────────────┬─────────────────╮
│ Key │ Function │ Details │
├─────┼──────────────┼─────────────────┤
│ z │ Zoxide jump │ Opens picker │
│ Z │ fzf search │ Recursive search│
╰─────┴──────────────┴─────────────────╯
With markdown-preview.nvim (in browser):
- Full HTML table with CSS styling
Spell Check in Neovim
Hide spelling errors:
- Disable spell check entirely:
vim:set nospell
- Or make it less intrusive in
~/.config/nvim/lua/config/options.lua:
luavim.opt.spell = false -- Disable by default
- Toggle spell check with keybind:
luavim.keymap.set("n", "<leader>us", function() vim.opt.spell = not vim.opt.spell:get() end, { desc = "Toggle Spelling" })
Quick Setup Script
Add render-markdown.nvim to your LazyVim:
bashcat > ~/.config/nvim/lua/plugins/render-markdown.lua << 'EOF' return { { "MeanderingProgrammer/render-markdown.nvim", opts = { heading = { enabled = true, icons = { " ", " ", " ", " ", " ", " " }, }, code = { enabled = true, style = "full", }, bullet = { enabled = true, }, }, dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons", }, ft = { "markdown" }, }, } EOF
Then restart Neovim.
Links
render-markdown.nvim GitHub
- URL: https://github.com/MeanderingProgrammer/render-markdown.nvim
- Summary: In-editor markdown rendering for Neovim with table support
- Related: Neovim, LazyVim, Markdown
markdown-preview.nvim GitHub
- URL: https://github.com/iamcco/markdown-preview.nvim
- Summary: Browser-based markdown preview with live reload
- Related: Neovim, Markdown