diff --git a/scaladoc-testcases/src/tests/markdowncode.scala b/scaladoc-testcases/src/tests/markdowncode.scala new file mode 100644 index 000000000000..ac8238b7f0f6 --- /dev/null +++ b/scaladoc-testcases/src/tests/markdowncode.scala @@ -0,0 +1,5 @@ +package tests.markdowncode + +/** Some text `{ ; }` */ +val aVal: Float + = 1.2f diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/DocRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/DocRenderer.scala index 19e7e8a86995..a2c653208a83 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/DocRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/DocRenderer.scala @@ -86,7 +86,7 @@ class DocRender(signatureRenderer: SignatureRenderer)(using DocContext): case Subscript(text) => span(cls:="subscript")(renderElement(text)) // TODO implement style case Link(target, body) => renderLink(target, default => body.fold[TagArg](default)(renderElement)) - case Text(text) => raw(text) + case Text(text) => raw(text.escapeReservedTokens) case Summary(text) => renderElement(text) case HtmlTag(content) => raw(content) diff --git a/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala b/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala index e56b741f5fee..699aff7b6cf6 100644 --- a/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala +++ b/scaladoc/test/dotty/tools/scaladoc/signatures/TranslatableSignaturesTestCases.scala @@ -92,3 +92,5 @@ class FBoundedTypeParameters extends SignatureTest("fboundedTypeParameters", Sig class Exports extends SignatureTest("exports2", SignatureTest.all, sourceFiles = List("exports1", "exports2")) class ContextFunctions extends SignatureTest("contextfunctions", SignatureTest.all) + +class MarkdownCode extends SignatureTest("markdowncode", SignatureTest.all)