From 2e4da1520a837a2044ab5adc3d440dc93c831b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Tue, 9 Jun 2020 14:26:58 +0200 Subject: [PATCH] Fix HTML escaping rules within Markdown emphasis. --- textfilter/vibe/textfilter/markdown.d | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/textfilter/vibe/textfilter/markdown.d b/textfilter/vibe/textfilter/markdown.d index aa3dbf6a81..7e4f3382d4 100644 --- a/textfilter/vibe/textfilter/markdown.d +++ b/textfilter/vibe/textfilter/markdown.d @@ -788,7 +788,7 @@ private void writeMarkdownEscaped(R)(ref R dst, string ln, in LinkRef[string] li string text; if (auto em = parseEmphasis(ln, text)) { dst.put(em == 1 ? "" : em == 2 ? "" : ""); - filterHTMLEscape(dst, text, HTMLEscapeFlags.escapeMinimal); + dst.put(text); dst.put(em == 1 ? "" : em == 2 ? "": ""); } else { dst.put(ln[0]); @@ -1685,3 +1685,9 @@ private struct Link { assert (filterMarkdown("- foo\n- %%%", MarkdownFlags.figures) == "\n
\n"); assert (filterMarkdown("- foo\n\n- %%%", MarkdownFlags.figures) == "\n
\n"); } + +@safe unittest { // HTML entities + assert(filterMarkdown(" ") == "

 \n

\n"); + assert(filterMarkdown("* *") == "

 \n

\n"); + assert(filterMarkdown("` `") == "

 \n

\n"); +}