mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Merge pull request #184 from rsmidt/add-missing-markdown-escape-char
Escape '>' using markdown utilities
This commit is contained in:
commit
637dcd2535
1 changed files with 3 additions and 2 deletions
|
@ -97,6 +97,7 @@ pub fn escape(s: &str) -> String {
|
||||||
.replace(")", r"\)")
|
.replace(")", r"\)")
|
||||||
.replace("~", r"\~")
|
.replace("~", r"\~")
|
||||||
.replace("`", r"\`")
|
.replace("`", r"\`")
|
||||||
|
.replace(">", r"\>")
|
||||||
.replace("#", r"\#")
|
.replace("#", r"\#")
|
||||||
.replace("+", r"\+")
|
.replace("+", r"\+")
|
||||||
.replace("-", r"\-")
|
.replace("-", r"\-")
|
||||||
|
@ -218,8 +219,8 @@ mod tests {
|
||||||
fn test_escape() {
|
fn test_escape() {
|
||||||
assert_eq!(escape("* foobar *"), r"\* foobar \*");
|
assert_eq!(escape("* foobar *"), r"\* foobar \*");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
escape(r"_ * [ ] ( ) ~ \ ` # + - = | { } . !"),
|
escape(r"_ * [ ] ( ) ~ \ ` > # + - = | { } . !"),
|
||||||
r"\_ \* \[ \] \( \) \~ \ \` \# \+ \- \= \| \{ \} \. \!",
|
r"\_ \* \[ \] \( \) \~ \ \` \> \# \+ \- \= \| \{ \} \. \!",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue