mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-31 19:05:00 +07:00
docs: Ensure macOS and Linux keybindings are escaped in HTML (#39802)
Closes #39654 Release Notes: - Fixed the formatting of macOS and Linux keybindings in the Zed docs to escape the backslash character when templating.
This commit is contained in:
parent
6aaf19f276
commit
55bc679c19
1 changed files with 8 additions and 1 deletions
|
|
@ -203,6 +203,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<PreprocessorError>) {
|
||||
let regex = Regex::new(r"\{#kb (.*?)\}").unwrap();
|
||||
|
||||
|
|
@ -223,7 +227,10 @@ fn template_and_validate_keybindings(book: &mut Book, errors: &mut HashSet<Prepr
|
|||
return "<div>No default binding</div>".to_string();
|
||||
}
|
||||
|
||||
format!("<kbd class=\"keybinding\">{macos_binding}|{linux_binding}</kbd>")
|
||||
let formatted_macos_binding = format_binding(macos_binding);
|
||||
let formatted_linux_binding = format_binding(linux_binding);
|
||||
|
||||
format!("<kbd class=\"keybinding\">{formatted_macos_binding}|{formatted_linux_binding}</kbd>")
|
||||
})
|
||||
.into_owned()
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue