Skip to content

bun913/live-markdown.nvim

Repository files navigation

live-markdown.nvim

Real-time markdown preview for Neovim.

日本語

demo

Features

  • Single binary — no runtime dependencies
  • Real-time preview with scroll sync
  • Syntax highlighting (light/dark auto-switch)
  • Math rendering (KaTeX)
  • Mermaid diagram rendering
  • Task lists (- [x] / - [ ])
  • Strikethrough (~~text~~)
  • Local image preview (relative paths supported)
  • GitHub-flavored styling (light/dark auto-switch)

Installation

lazy.nvim

{
  "bun913/live-markdown.nvim",
  cmd = { "MarkdownPreview", "MarkdownPreviewStop" },
  build = "scripts/install.sh",
  config = function()
    require("live-markdown").setup()
  end,
}

With a custom browser strategy:

{
  "bun913/live-markdown.nvim",
  cmd = { "MarkdownPreview", "MarkdownPreviewStop" },
  build = "scripts/install.sh",
  config = function()
    require("live-markdown").setup({
      browser = {
        strategy = "cmux browser open-split",
      },
    })
  end,
}

Pre-built binaries are downloaded from GitHub Releases. No runtime dependencies required.

Usage

:MarkdownPreview       " Open preview in browser
:MarkdownPreviewStop   " Close preview

Configuration

require("live-markdown").setup({
  server = {
    port = 0,            -- 0 = OS auto-assigns
    host = "localhost",
    binary = nil,        -- path to compiled binary (nil = auto-detect bin/live-markdown)
  },
  browser = {
    strategy = "auto",   -- "auto" | "open" | "xdg-open" | custom command
  },
  render = {
    css = "github-markdown",
    mermaid = true,
  },
  scroll_sync = true,
})

Browser strategy

Strategy Description
"auto" Auto-detect: macOS open, Linux xdg-open
"open" macOS default browser
"xdg-open" Linux default browser
Custom string Executed as shell command with URL appended

Example with a custom command:

require("live-markdown").setup({
  browser = {
    strategy = "cmux browser open-split",
  },
})

License

MIT

About

Real-time markdown preview for Neovim.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors