diff --git a/crates/docs_preprocessor/src/main.rs b/crates/docs_preprocessor/src/main.rs index e8f81812ccdf2e..6fb71dcaf6a0f1 100644 --- a/crates/docs_preprocessor/src/main.rs +++ b/crates/docs_preprocessor/src/main.rs @@ -163,6 +163,10 @@ fn template_big_table_of_actions(book: &mut Book) { }); } +fn format_binding(binding: String) -> String { + binding.replace("\\", "\\\\") +} + fn template_and_validate_keybindings(book: &mut Book, errors: &mut HashSet) { let regex = Regex::new(r"\{#kb (.*?)\}").unwrap(); @@ -183,7 +187,10 @@ fn template_and_validate_keybindings(book: &mut Book, errors: &mut HashSetNo default binding".to_string(); } - format!("{macos_binding}|{linux_binding}") + let formatted_macos_binding = format_binding(macos_binding); + let formatted_linux_binding = format_binding(linux_binding); + + format!("{formatted_macos_binding}|{formatted_linux_binding}") }) .into_owned() });