GitHub

Live markdown preview in a Neovim split window with Treesitter parsing and clean rendering.

Screenshot showing side by side of raw markdown and rendered preview

Screenshot showing code blocks and lists

Features

  • Live preview updates as you type
  • Treesitter-based markdown parsing
  • Vertical split window
  • Styled headings with Unicode box-drawing (heavy → double → underline)
  • Code blocks with syntax highlighting
  • Clean list rendering (with bullets)
  • Blockquote formatting
  • Synced scrolling
  • No external dependencies (pure Neovim + Treesitter)

Requirements

  • Neovim 0.9+ (for Treesitter support)
  • markdown Treesitter parser installed

Installation

Using lazy.nvim

{
  'ducks/mdpreview.nvim',
  ft = 'markdown',
  cmd = { 'MDPreview', 'MDPreviewClose', 'MDPreviewToggle' },
  config = function()
    require('mdpreview').setup()
  end
}

Using packer.nvim

use {
  'ducks/mdpreview.nvim',
  ft = 'markdown',
  config = function()
    require('mdpreview').setup()
  end
}

Install markdown Treesitter parser

:TSInstall markdown markdown_inline

Usage

Commands

  • :MDPreview - Open preview in vertical split
  • :MDPreviewClose - Close preview window
  • :MDPreviewToggle - Toggle preview on/off

Keybindings

Add to your config:

vim.keymap.set('n', '<leader>mp', ':MDPreviewToggle<CR>', { desc = 'Toggle markdown preview' })

How It Works

  1. Opens a vertical split window
  2. Parses markdown with Treesitter
  3. Renders with clean formatting (styled headers, bullets, quotes)
  4. Updates automatically on buffer changes (TextChanged, TextChangedI, BufWritePost)

Rendering

Headings

All heading levels (h1-h6) are rendered with Unicode box-drawing styles that create a clear visual hierarchy:

  • h1+h2: Heavy box style (┏━┓) - Most prominent, h1 bold
  • h3+h4: Double box style (╔═╗) - Medium prominence, h3 bold
  • h5+h6: Underline style ( / ) - Lightest weight, h5 bold

Each pair of heading levels shares the same decorative style, while odd levels (h1, h3, h5) use bold highlighting for additional emphasis. This creates three distinct visual tiers that make document structure immediately clear.

Lists

- Item one
- Item two

Renders as:

  • Item one
  • Item two

Blockquotes

> This is a quote
> Multiple lines

Renders as:

┃ This is a quote
┃ Multiple lines

Code Blocks

Fenced code blocks with language-specific syntax highlighting using Treesitter.

Configuration

Currently no configuration options (plugin works out of the box).

Differences from render-markdown.nvim

  • Renders in a separate split window (not inline)
  • Simpler, focused on clean preview
  • No concealment or virtual text in source buffer
  • Updates live as you type

License

MIT

Related Projects

  • vimdeck.nvim - Markdown presentations with slide navigation
  • render-markdown.nvim - Inline markdown rendering

Read the original on github.com ↗