Commit 219fb9d1 authored by Christian Hergert's avatar Christian Hergert

html-preview: use json.dumps() for markup conversion

Certainly better for most scenarios. May need further tweaking by someone
who cares enough to track down what marked.js is doing.

Fixes #1244
parent e6437be7
Pipeline #192976 passed with stage
in 46 minutes and 48 seconds
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
import builtins import builtins
import gi import gi
import html
import io import io
import json
import locale import locale
import os import os
import shutil import shutil
...@@ -435,7 +435,7 @@ class HtmlPreviewPage(Ide.Page): ...@@ -435,7 +435,7 @@ class HtmlPreviewPage(Ide.Page):
def get_markdown(self, text): def get_markdown(self, text):
params = (HtmlPreviewData.MARKDOWN_CSS.get_data().decode('UTF-8'), params = (HtmlPreviewData.MARKDOWN_CSS.get_data().decode('UTF-8'),
html.escape(text).replace('\n', '\\n'), json.dumps(text),
HtmlPreviewData.MARKED_JS.get_data().decode('UTF-8'), HtmlPreviewData.MARKED_JS.get_data().decode('UTF-8'),
HtmlPreviewData.MARKDOWN_VIEW_JS.get_data().decode('UTF-8')) HtmlPreviewData.MARKDOWN_VIEW_JS.get_data().decode('UTF-8'))
...@@ -443,7 +443,7 @@ class HtmlPreviewPage(Ide.Page): ...@@ -443,7 +443,7 @@ class HtmlPreviewPage(Ide.Page):
<html> <html>
<head> <head>
<style>%s</style> <style>%s</style>
<script>var str="%s";</script> <script>var str=%s;</script>
<script>%s</script> <script>%s</script>
<script>%s</script> <script>%s</script>
</head> </head>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment