Fix CodeBlockRenderer.Write

This commit is contained in:
prozolic
2025-04-27 16:49:05 +09:00
parent 09a4b81a6e
commit c41b389053
2 changed files with 9 additions and 1 deletions

View File

@@ -26,6 +26,14 @@ public class TestPlainText
Assert.AreEqual(expected, actual);
}
[Test]
[TestCase(/* markdownText: */ "```\nConsole.WriteLine(\"Hello, World!\");\n```", /* expected: */ "Console.WriteLine(\"Hello, World!\");\n")]
public void TestPlainCodeBlock(string markdownText, string expected)
{
var actual = Markdown.ToPlainText(markdownText);
Assert.AreEqual(expected, actual);
}
[Test]
[TestCase(/* markdownText: */ ":::\nfoo\n:::", /* expected: */ "foo\n", /*extensions*/ "customcontainers|advanced")]
[TestCase(/* markdownText: */ ":::bar\nfoo\n:::", /* expected: */ "foo\n", /*extensions*/ "customcontainers+attributes|advanced")]

View File

@@ -100,7 +100,7 @@ public class CodeBlockRenderer : HtmlObjectRenderer<CodeBlock>
renderer.WriteRaw('>');
}
renderer.WriteLeafRawLines(obj, true, true);
renderer.WriteLeafRawLines(obj, true, renderer.EnableHtmlEscape);
if (renderer.EnableHtmlForBlock)
{