pub fn escape_str(s: &str) -> String
Expand description
Escapes special characters in a string (e.g., backslashes and quotes).
§Arguments
s
- The input string to escape.
§Returns
A new String
with special characters escaped.
§Examples
use frontmatter_gen::types::escape_str;
assert_eq!(escape_str(r#"Hello "World""#), r#"Hello \"World\""#);
assert_eq!(escape_str(r#"C:\path\to\file"#), r#"C:\\path\\to\\file"#);