Repository navigation
Releases: sammaji/markdown-preview.nvim
Releases · sammaji/markdown-preview.nvim
Release list
v0.2.0
Security
- The WebSocket refuses connections from other web sites, which could otherwise read the previewed buffer through
ws://localhost. - With
g:mkdp_open_to_the_world, the preview URL carries a random token and the server answers pages, images and the WebSocket only with it (the page keeps it in a cookie). Share the whole URL. - The assets endpoint now only serves images, audio and video. Before, any file the server could read was served, e.g.
/_local_image_/etc/passwd, to anyone on the network withg:mkdp_open_to_the_world.
Changed
- The preview URL is the file's path relative to the editor's working directory, e.g.
/files/docs/guide.md, instead of the buffer number. Files outside it and unnamed buffers keep/page/<bufnr>. - The documentation now lives in mkdp.sammaji.com.
- The page is styled with shadcn/ui theme variables, with shadcn's neutral theme as the default look, and GitHub's code colors in both themes. The page sets the
darkclass on<html>in the dark theme, as shadcn themes expect;data-themeis still set for custom CSS. - Diagrams are drawn with the theme's colors - Mermaid (unless
maidsets atheme), flowchart.js, sequence diagrams, Graphviz and PlantUML. Before, most drew black on white, unreadable in the dark theme.
Added
g:mkdp_theme_css: a theme from shadcn or tweakcn.com (Tailwind v3 and v4 formats). The theme can load font files from its own folder.g:mkdp_browsercan be a list, run as a command with the URL appended, e.g.{ "firefox", "-P", "work" }(iamcco#55, iamcco#639, iamcco#517).require("markdown-preview").setup({ ... })for Lua configuration, so lazy.nvim'soptsworks (iamcco#705).g:mkdp_on_start(called with the preview URL) andg:mkdp_on_stophooks.- GitHub alerts:
> [!NOTE],[!TIP],[!IMPORTANT],[!WARNING]and[!CAUTION](iamcco#663, iamcco#632). preview_options.front_matter = "panel"shows YAML front matter in a collapsible panel (iamcco#521).- A full-screen viewer for Mermaid diagrams: zoom, pan, fit and download as SVG.
maid = { layout = "elk" }(orlayout: elkin a diagram) uses Mermaid's ELK layout.- Links to other markdown files work in the preview: clicking
[guide](docs/guide.md)opens that file, showing its buffer if the editor has it open or the file from disk otherwise. Only files under the editor's working directory can be opened (iamcco#58, iamcco#699, iamcco#683). - Pre-built binaries for Linux arm64 and FreeBSD x64 (iamcco#287, iamcco#321).
Fixed
- WSL support: the browser is opened with
wslview, thencmd.exe, thenxdg-open, whichever exists, and ag:mkdp_browserLinux browser runs directly (iamcco#710, iamcco#741). When nothing can open it, the error shows the URL. - The log file is per user (
mkdp-nvim-<uid>.log), so a file another user left no longer breaks logging (iamcco#737). g:mkdp_auto_closeworks in Vim, where leaving a buffer unloads it.:MarkdownPreviewStopsometimes left the page showing "Disconnected" instead of "Preview stopped".- 32-bit Linux no longer downloads the x86_64 binary;
install.shreports an unsupported system and exits with an error. - A Mermaid diagram broken by an edit keeps showing its last good drawing, with the error above it, instead of flickering to an error while you type.
<details>sections keep their open or closed state while you type (iamcco#600).- Sync scroll interpolated lines after the first element from the top of the page.
- Partial
g:mkdp_preview_optionskeep the defaults of the keys they leave out. - A port taken on IPv6 (
[::1]) is skipped. Before, the preview could bind the same port on127.0.0.1and the browser, tryinglocalhostas::1first, opened the other server. :MarkdownPreviewand the other commands exist in the first buffer when a plugin manager loads the plugin on its filetype. Options set throughsetup()after the plugin has loaded (filetypes,auto_start,command_for_global,combine_preview_auto_refresh) take effect too.
Authors
v0.1.1
Added
- The server binary is installed automatically.
:MarkdownPreviewdownloads it when it is missing, or when it does not match the plugin version after an update, and opens the preview once the download has finished. A plugin manager build hook is no longer required; acargo build --releasebinary intarget/releaseis still used as is and never triggers a download (#6). :checkhealth mkdpwarns when the installed binary does not match the plugin version.
Changed
- lazy.nvim installs the binary on
:Lazy installand refreshes it on:Lazy updatewith no configuration, through abuild.luain the repository. Other plugin managers keep using a build hook, nowmkdp#util#install_sync(), which waits for the download to finish so the manager reports the real result. app/install.shandapp/install.cmdwithout a tag argument now install the release matching the plugin'sCargo.tomlversion instead of the newest release, so a bare run agrees with what the plugin expects.
Fixed
mkdp#util#install_sync()no longer leaves the window's directory pointing at the plugin'sapp/directory.
Authors
v0.1.0
The preview server is rewritten in Rust and the preview page is rebuilt on Next.js 16. Node.js is no longer needed to use the plugin.
Breaking changes
- The server is a single self-contained binary. Install it with
mkdp#util#install()(downloads a pre-built binary for macOS x64/arm64, Linux x64 or Windows x64) or build it withcargo build --release. Build hooks such asbuild = "npm install"orcd app && yarn installno longer work and must be replaced. - Building from source needs Rust 1.86+ and Node.js 20.9+ with pnpm (or npx);
cargo buildbuilds the preview page automatically. - Charts use Chart.js 4. Chart configs written for Chart.js 2 need to be migrated, e.g.
options.scales.xAxesbecomesoptions.scales.x. - The preview page talks to the server over a WebSocket at
/wsinstead of socket.io.
Added
- Starting a preview no longer fails when
g:mkdp_portis taken; the next free port is used instead. - The theme toggle redraws diagrams in the new theme.
- The page header shows when the page is disconnected from the editor or the preview was stopped, and the page reconnects automatically.
- Reloading the preview page works.
:checkhealth mkdpshows the server binary in use and its version.- A GitHub Actions workflow builds and publishes release binaries for tags.
test/features.md, a sample document that uses every feature.
Changed
- The preview page is rebuilt with Next.js 16, React 19 and TypeScript, with updated renderers: markdown-it 15, KaTeX 0.18, Mermaid 12, highlight.js 11 and Graphviz through
@viz-js/viz. - Mermaid, Chart.js, flowchart, sequence diagram and Graphviz libraries are only loaded when a document uses them, cutting the initial page download from about 8 MB to 1.5 MB.
- Buffer refreshes fetch everything from the editor in a single request, and bursts of cursor movement are coalesced into one refresh.
- Files are served with correct content types.
Fixed
- Opening previews from several vim or neovim instances with the same
g:mkdp_portshowed an uncaught exception (processTicksAndRejections) instead of a preview. g:mkdp_clients_activestayed set after preview pages disconnected.- HTML in diagram sources and image alt texts could break the page.
Removed
- The Node.js server, including the
node app/index.jsfallback, and the vendored copies of KaTeX, Mermaid, viz.js, flowchart.js, Raphaël and TweenLite.