aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index d84b082..54d7586 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -41,12 +41,16 @@ fn replace_tags(input: String, entry: &Entry) -> String {
}
/**
- * Method that escapes some characters that would break json spec
+ * Method that escapes some characters that would break json spec, and also escape
+ * special HTML characters.
*/
fn escape(input: String) -> String {
return input.replace("\\","\\\\")
.replace("\"", "\\\"")
- .replace("\n", "\\n");
+ .replace("\n", "\\n")
+ .replace("<", "&lt;")
+ .replace(">", "&gt;")
+ .replace("&", "$amp;");
}
/**