Escape backticks so text can be used in a JS template.
(text: str)
| 418 | |
| 419 | |
| 420 | def escape_backticks(text: str) -> str: |
| 421 | """Escape backticks so text can be used in a JS template.""" |
| 422 | return re.sub(r"(?<!\\)`", r"\`", text) |
| 423 | |
| 424 | |
| 425 | def escape_double_quotes(text: str) -> str: |