From 31e85ec58000ce8256c3df893eeb784c39a89683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20M=C3=A4der?= Date: Thu, 8 Apr 2021 11:38:05 +0200 Subject: [PATCH] Use cheerio api for code replacements --- src/editor/serialize.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/editor/serialize.ts b/src/editor/serialize.ts index 50bebf8f08..5167e3d376 100644 --- a/src/editor/serialize.ts +++ b/src/editor/serialize.ts @@ -128,9 +128,8 @@ export function htmlSerializeIfNeeded(model: EditorModel, {forceHTML = false} = // since maths delimiters are handled before Markdown, // code blocks could contain mangled content. // replace code blocks with original content - phtml('code').contents().each(function(i) { - const origData = phtmlOrig('code').contents()[i].data; - phtml('code').contents()[i].data = origData; + phtmlOrig('code').each(function(i) { + phtml('code').eq(i).text(phtmlOrig('code').eq(i).text()); }); // add fallback output for latex math, which should not be interpreted as markdown