You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 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.
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).
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.