We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1c4c220 + 5318e89 commit dbd0b03Copy full SHA for dbd0b03
crates/ide/src/markdown_remove.rs
@@ -23,7 +23,10 @@ pub(crate) fn remove_markdown(markdown: &str) -> String {
23
}
24
25
26
- if let Some(p) = out.rfind(|c| c != '\n') {
+ if let Some(mut p) = out.rfind(|c| c != '\n') {
27
+ while !out.is_char_boundary(p + 1) {
28
+ p += 1;
29
+ }
30
out.drain(p + 1..);
31
32
@@ -151,4 +154,10 @@ book] or the [Reference].
151
154
152
155
For more information on the various types of functions and how they're used, consult the Rust book or the Reference."#]].assert_eq(&res);
153
156
157
+
158
+ #[test]
159
+ fn on_char_boundary() {
160
+ expect!["a┘"].assert_eq(&remove_markdown("```text\na┘\n```"));
161
+ expect!["وقار"].assert_eq(&remove_markdown("```\nوقار\n```\n"));
162
163
0 commit comments