Markdown highlight wrong with `*` in inline code block
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
I would like to report a bug with markdown rendering. When an asterisk is included in an inline code block, the syntax highlighting does not work correctly.
Both .md file and assistant panel cannot handle * in inline block correctly.
Environment
Zed: v0.135.2 (Zed) OS: macOS 14.5.0 Memory: 8 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
No response
I checked further into this one, the issue seems to be the tree-sitter-markdown package itself. The grammar of the current version does't manage any special syntax inside the code_span, for example if you put a break html tag or a link inside it also breaks.
Here below I leave just as reference how the current tree breaks with a simple example:
use tree_sitter::Parser;
fn main() {
// Create a parser
let mut parser = Parser::new();
parser
.set_language(tree_sitter_md::language())
.expect("Error loading Markdown grammar");
// Markdown string to parse
let md = "Simple paragraph. \n `something here inside` then `*h hello`";
// Parse the md string
let tree = parser.parse(md, None).unwrap();
// Print the syntax tree
println!("{:#?}", tree.root_node().to_sexp());
}
As output of this you will see that the tree is broken:
"(document (paragraph) (paragraph (MISSING \"_newline_token1\")))"
BTW I know that it can be annoying but if you leave a space before the * it will work.
The newest versions of the tree-sitter-markdown seems to parse it correctly but have a huge breaking change since the parsing of the markdown was broken into two parts, the block and the inline.
Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!