Skip to content

Releases: sammaji/markdown-preview.nvim

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 27 Sep 09:48
8190248

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 with g: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 dark class on <html> in the dark theme, as shadcn themes expect; data-theme is still set for custom CSS.
  • Diagrams are drawn with the theme's colors - Mermaid (unless maid sets a theme), 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_browser can 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's opts works (iamcco#705).
  • g:mkdp_on_start (called with the preview URL) and g:mkdp_on_stop hooks.
  • 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" } (or layout: elk in 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, then cmd.exe, then xdg-open, whichever exists, and a g:mkdp_browser Linux 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_close works in Vim, where leaving a buffer unloads it.
  • :MarkdownPreviewStop sometimes left the page showing "Disconnected" instead of "Preview stopped".
  • 32-bit Linux no longer downloads the x86_64 binary; install.sh reports 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_options keep the defaults of the keys they leave out.
  • A port taken on IPv6 ([::1]) is skipped. Before, the preview could bind the same port on 127.0.0.1 and the browser, trying localhost as ::1 first, opened the other server.
  • :MarkdownPreview and the other commands exist in the first buffer when a plugin manager loads the plugin on its filetype. Options set through setup() after the plugin has loaded (filetypes, auto_start, command_for_global, combine_preview_auto_refresh) take effect too.

Authors

v0.1.1

Choose a tag to compare

@github-actions github-actions released this 19 Sep 12:17
8bbc970

Added

  • The server binary is installed automatically. :MarkdownPreview downloads 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; a cargo build --release binary in target/release is still used as is and never triggers a download (#6).
  • :checkhealth mkdp warns when the installed binary does not match the plugin version.

Changed

  • lazy.nvim installs the binary on :Lazy install and refreshes it on :Lazy update with no configuration, through a build.lua in the repository. Other plugin managers keep using a build hook, now mkdp#util#install_sync(), which waits for the download to finish so the manager reports the real result.
  • app/install.sh and app/install.cmd without a tag argument now install the release matching the plugin's Cargo.toml version 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's app/ directory.

Authors

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 14 Sep 17:43
c32ce64

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 with cargo build --release. Build hooks such as build = "npm install" or cd app && yarn install no longer work and must be replaced.
  • Building from source needs Rust 1.86+ and Node.js 20.9+ with pnpm (or npx); cargo build builds the preview page automatically.
  • Charts use Chart.js 4. Chart configs written for Chart.js 2 need to be migrated, e.g. options.scales.xAxes becomes options.scales.x.
  • The preview page talks to the server over a WebSocket at /ws instead of socket.io.

Added

  • Starting a preview no longer fails when g:mkdp_port is 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 mkdp shows 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_port showed an uncaught exception (processTicksAndRejections) instead of a preview.
  • g:mkdp_clients_active stayed 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.js fallback, and the vendored copies of KaTeX, Mermaid, viz.js, flowchart.js, Raphaël and TweenLite.

Authors

v0.0.10

Choose a tag to compare

@sammaji sammaji released this 22 Aug 19:06
a923f5f

Authors