| Crates.io | markdown-live-preview |
| lib.rs | markdown-live-preview |
| version | 0.1.0 |
| created_at | 2025-06-18 02:02:30.996962+00 |
| updated_at | 2025-06-18 02:02:30.996962+00 |
| description | A live Markdown preview server with WebSocket and HTML rendering |
| homepage | |
| repository | https://github.com/popplestones/markdown-live-preview |
| max_upload_size | |
| id | 1716458 |
| size | 99,599 |
A Rust-powered live Markdown preview server that integrates with Neovim via TCP.
Renders GitHub-flavored Markdown (GFM) using Comrak, served via Axum, and controlled in real time from an md-live-preview.nvim plugin.
[!NOTE] This project is designed to be paired with a Neovim plugin that streams buffer changes and cursor position.
| Feature | Status | Notes |
|---|---|---|
| Live buffer preview | โ | Renders latest Markdown buffer to HTML |
| Cursor tracking | โ | Receives cursor position updates |
| Incremental updates | โ | Only sends changed lines |
| GFM rendering | โ | Uses comrak with alerts, tables, etc. |
| Local TCP interface | โ | Neovim pushes updates to 127.0.0.1:3001 |
| HTML server | โ | Axum serves preview on http://localhost:3000 |
| Auto-launch browser | โ | Opens system browser on start |
| WebSocket live reload | ๐ง | Planned |
md-live-preview.nvim installed and configuredgit clone https://github.com/popplestones/markdown-live-preview
cd markdown-live-preview
cargo build --release
./target/release/markdown-live-preview
The server listens on 127.0.0.1:3001 for newline-delimited JSON messages.
{
"event": "init",
"data": {
"content": ["# Hello", "world!"],
"cursor": [1, 0]
}
}
Supported event types:
| Event | Payload Structure |
|---|---|
| init | { content: Vec |
| buffer_change | { line: usize, new_text: String } |
| cursor_moved | { cursor: (usize, usize) } |
[!TIP] Lines are indexed from zero.
[ Neovim (plugin) ] --> TCP (127.0.0.1:3001) --> [ markdown-live-preview ]
--> Axum --> HTML preview (localhost:3000)
You can log incoming messages using:
RUST_LOG=debug ./target/release/markdown-live-preview
[!WARNING] Always restart the server if you change port bindings or encounter connection issues.
MIT ยฉ Shane Poppleton