diff --git a/Cargo.lock b/Cargo.lock index 5d17718982d1717078b1dee702c101c8352bdb38..0aadd18f662e46f0702390405eb815a324f4caa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5143,6 +5143,15 @@ dependencies = [ "regex", ] +[[package]] +name = "tree-sitter-markdown" +version = "0.0.1" +source = "git+https://github.com/maxbrunsfeld/tree-sitter-markdown?rev=b2b4eefd51ada972ef8bb581b83b6b8e7a28c7a6#b2b4eefd51ada972ef8bb581b83b6b8e7a28c7a6" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-rust" version = "0.20.0" @@ -5730,6 +5739,7 @@ dependencies = [ "tiny_http", "toml", "tree-sitter", + "tree-sitter-markdown", "tree-sitter-rust", "unindent", "url", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 3c894f8894bd032b889b490dd8aa7e933223c14c..e03ef6dcf9ccd02989c294f94cc495f2f97986be 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -86,6 +86,7 @@ tiny_http = "0.8" toml = "0.5" tree-sitter = "0.20.0" tree-sitter-rust = "0.20.0" +tree-sitter-markdown = { git = "https://github.com/maxbrunsfeld/tree-sitter-markdown", rev = "b2b4eefd51ada972ef8bb581b83b6b8e7a28c7a6" } url = "2.2" [dev-dependencies] diff --git a/crates/zed/assets/themes/black.toml b/crates/zed/assets/themes/black.toml index ec51391111e67ecb9c8f8e5394cf4ae5fca55da1..a822fa7d3346c1ba2b5aac359ceb1ac940c9a73f 100644 --- a/crates/zed/assets/themes/black.toml +++ b/crates/zed/assets/themes/black.toml @@ -50,3 +50,10 @@ comment = "#6a9955" property = "#4e94ce" variant = "#4fc1ff" constant = "#9cdcfe" + +title = { color = "#9cdcfe", weight = "bold" } +emphasis = "#4ec9b0" +"emphasis.strong" = { color = "#4ec9b0", weight = "bold" } +link_uri = { color = "#6a9955", underline = true } +link_text = { color = "#cb8f77", italic = true } +list_marker = "#4e94ce" diff --git a/crates/zed/assets/themes/dark.toml b/crates/zed/assets/themes/dark.toml index 15850f286ab3c0293b261ae987b5ea4af8259064..9d65a160eb6d1a6ff19c448a19c0231176cd4178 100644 --- a/crates/zed/assets/themes/dark.toml +++ b/crates/zed/assets/themes/dark.toml @@ -50,3 +50,10 @@ comment = "#6a9955" property = "#4e94ce" variant = "#4fc1ff" constant = "#9cdcfe" + +title = { color = "#9cdcfe", weight = "bold" } +emphasis = "#4ec9b0" +"emphasis.strong" = { color = "#4ec9b0", weight = "bold" } +link_uri = { color = "#6a9955", underline = true } +link_text = { color = "#cb8f77", italic = true } +list_marker = "#4e94ce" diff --git a/crates/zed/assets/themes/light.toml b/crates/zed/assets/themes/light.toml index 5a893368c3acc1a5f72cc194edd1595c5d63851e..18134501ece21622abeb5dd5bca0a958e66f7464 100644 --- a/crates/zed/assets/themes/light.toml +++ b/crates/zed/assets/themes/light.toml @@ -49,4 +49,11 @@ number = "#b5cea8" comment = "#6a9955" property = "#4e94ce" variant = "#4fc1ff" -constant = "#9cdcfe" +constant = "#5a9ccc" + +title = { color = "#5a9ccc", weight = "bold" } +emphasis = "#267f29" +"emphasis.strong" = { color = "#267f29", weight = "bold" } +link_uri = { color = "#6a9955", underline = true } +link_text = { color = "#a82121", italic = true } +list_marker = "#4e94ce" diff --git a/crates/zed/languages/markdown/highlights.scm b/crates/zed/languages/markdown/highlights.scm new file mode 100644 index 0000000000000000000000000000000000000000..65ac47ec4bd5537bb5d07301bc6eb9a48124622a --- /dev/null +++ b/crates/zed/languages/markdown/highlights.scm @@ -0,0 +1,24 @@ +(emphasis) @emphasis +(strong_emphasis) @emphasis.strong + +[ + (atx_heading) + (setext_heading) +] @title + +[ + (list_marker_plus) + (list_marker_minus) + (list_marker_star) + (list_marker_dot) + (list_marker_parenthesis) +] @list_marker + +[ + (indented_code_block) + (fenced_code_block) + (code_span) +] @text.literal + +(link_destination) @link_uri +(link_text) @link_text diff --git a/crates/zed/src/language.rs b/crates/zed/src/language.rs index c045804e92d92abf35c6e183e6bdb3b858536358..a84d2cbd40b7a9d16734056e29ce79c18a173bff 100644 --- a/crates/zed/src/language.rs +++ b/crates/zed/src/language.rs @@ -27,8 +27,11 @@ fn rust() -> Language { } fn markdown() -> Language { + let grammar = tree_sitter_markdown::language(); let config = toml::from_slice(&LanguageDir::get("markdown/config.toml").unwrap().data).unwrap(); - Language::new(config, None) + Language::new(config, Some(grammar)) + .with_highlights_query(load_query("markdown/highlights.scm").as_ref()) + .unwrap() } fn load_query(path: &str) -> Cow<'static, str> {