Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ members = [
"crates/lsp",
"crates/markdown",
"crates/markdown_preview",
"crates/mermaid_preview",
"crates/media",
"crates/menu",
"crates/migrator",
Expand Down Expand Up @@ -353,6 +354,7 @@ lmstudio = { path = "crates/lmstudio" }
lsp = { path = "crates/lsp" }
markdown = { path = "crates/markdown" }
markdown_preview = { path = "crates/markdown_preview" }
mermaid_preview = { path = "crates/mermaid_preview" }
svg_preview = { path = "crates/svg_preview" }
media = { path = "crates/media" }
menu = { path = "crates/menu" }
Expand Down Expand Up @@ -564,6 +566,7 @@ log = { version = "0.4.16", features = ["kv_unstable_serde", "serde"] }
lsp-types = { git = "https://github.com/zed-industries/lsp-types", rev = "fb6bcad59522455a041b7eb9579f706e5cfb2d6f" }
mach2 = "0.5"
markup5ever_rcdom = "0.3.0"
mermaid-rs-renderer = { version = "0.1.2", default-features = false }
metal = "0.29"
minidumper = "0.8"
moka = { version = "0.12.10", features = ["sync"] }
Expand Down
8 changes: 8 additions & 0 deletions assets/keymaps/default-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,14 @@
"ctrl-shift-v": "svg::OpenPreview",
},
},
{
"context": "Editor && (extension == mmd || extension == mermaid)",
"use_key_equivalents": true,
"bindings": {
"ctrl-k v": "mermaid::OpenPreviewToTheSide",
"ctrl-shift-v": "mermaid::OpenPreview",
},
},
{
"context": "Editor && mode == full",
"bindings": {
Expand Down
8 changes: 8 additions & 0 deletions assets/keymaps/default-macos.json
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,14 @@
"cmd-shift-v": "svg::OpenPreview",
},
},
{
"context": "Editor && (extension == mmd || extension == mermaid)",
"use_key_equivalents": true,
"bindings": {
"cmd-k v": "mermaid::OpenPreviewToTheSide",
"cmd-shift-v": "mermaid::OpenPreview",
},
},
{
"context": "Editor && mode == full",
"use_key_equivalents": true,
Expand Down
8 changes: 8 additions & 0 deletions assets/keymaps/default-windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@
"ctrl-shift-v": "svg::OpenPreview",
},
},
{
"context": "Editor && (extension == mmd || extension == mermaid)",
"use_key_equivalents": true,
"bindings": {
"ctrl-k v": "mermaid::OpenPreviewToTheSide",
"ctrl-shift-v": "mermaid::OpenPreview",
},
},
{
"context": "Editor && mode == full",
"use_key_equivalents": true,
Expand Down
23 changes: 23 additions & 0 deletions crates/mermaid_preview/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "mermaid_preview"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"

[lints]
workspace = true

[lib]
path = "src/mermaid_preview.rs"

[dependencies]
anyhow.workspace = true
gpui.workspace = true
language.workspace = true
multi_buffer.workspace = true
file_icons.workspace = true
ui.workspace = true
workspace.workspace = true
zed_actions.workspace = true
mermaid-rs-renderer.workspace = true
24 changes: 24 additions & 0 deletions crates/mermaid_preview/src/mermaid_preview.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use gpui::{App, actions};
use workspace::Workspace;

pub mod mermaid_preview_view;

pub use zed_actions::preview::mermaid::{OpenPreview, OpenPreviewToTheSide};

actions!(
mermaid,
[
/// Opens a following Mermaid preview that syncs with the editor.
OpenFollowingPreview
]
);

pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, window, cx| {
let Some(window) = window else {
return;
};
crate::mermaid_preview_view::MermaidPreviewView::register(workspace, window, cx);
})
.detach();
}
Loading