We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ee1d6cf + 31af94b commit ba2b599Copy full SHA for ba2b599
crates/rust-analyzer/src/markdown.rs
@@ -25,6 +25,13 @@ pub(crate) fn format_docs(src: &str) -> String {
25
}
26
27
28
+ if in_code_block {
29
+ let trimmed = line.trim_start();
30
+ if trimmed.starts_with("##") {
31
+ line = &trimmed[1..];
32
+ }
33
34
+
35
processed_lines.push(line);
36
37
processed_lines.join("\n")
@@ -136,4 +143,14 @@ let a = 1;
136
143
"```text\nfiller\ntext\n```\nSome comment.\n```rust\nlet a = 1;\n```"
137
144
);
138
145
146
147
+ #[test]
148
+ fn test_format_docs_handles_escape_double_hashes() {
149
+ let comment = r#"```rust
150
+let s = "foo
151
+## bar # baz";
152
+```"#;
153
154
+ assert_eq!(format_docs(comment), "```rust\nlet s = \"foo\n# bar # baz\";\n```");
155
139
156
0 commit comments