[gnome-builder] html-preview: use Python's html.escape()



commit 0c9c77ea30620b4ecd873ab9bc38069869be49db
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 23 09:26:32 2020 -0700

    html-preview: use Python's html.escape()
    
    Fixes #1244

 src/plugins/html-preview/html_preview.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/html-preview/html_preview.py b/src/plugins/html-preview/html_preview.py
index 9d5806744..4568f79f4 100644
--- a/src/plugins/html-preview/html_preview.py
+++ b/src/plugins/html-preview/html_preview.py
@@ -21,6 +21,7 @@
 
 import builtins
 import gi
+import html
 import io
 import locale
 import os
@@ -433,9 +434,8 @@ class HtmlPreviewPage(Ide.Page):
         self.webview = None
 
     def get_markdown(self, text):
-        text = text.replace("\"", "\\\"").replace("\n", "\\n")
         params = (HtmlPreviewData.MARKDOWN_CSS.get_data().decode('UTF-8'),
-                  text,
+                  html.escape(text),
                   HtmlPreviewData.MARKED_JS.get_data().decode('UTF-8'),
                   HtmlPreviewData.MARKDOWN_VIEW_JS.get_data().decode('UTF-8'))
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]