From c39b77823461dba7f47debc6fba885069cc3735b Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 1 Oct 2022 20:50:05 -0800 Subject: [PATCH] properly escape content --- src/pasta.rs | 4 ++++ templates/pasta.html | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pasta.rs b/src/pasta.rs index 3a54070..a728211 100644 --- a/src/pasta.rs +++ b/src/pasta.rs @@ -80,6 +80,10 @@ impl Pasta { pub fn content_not_highlighted(&self) -> String { html_highlight(&self.content, "txt") } + + pub fn content_escaped(&self) -> String { + self.content.replace("`", "\\`").replace("$", "\\$") + } } impl fmt::Display for Pasta { diff --git a/templates/pasta.html b/templates/pasta.html index adf52cb..587619c 100644 --- a/templates/pasta.html +++ b/templates/pasta.html @@ -33,7 +33,7 @@