From 7c3b12f9ecc2420e817ac4f9be3fcbfc0243f9dd Mon Sep 17 00:00:00 2001 From: "Irina.Chernushina" Date: Mon, 16 Oct 2017 11:11:31 +0200 Subject: [PATCH] json schema: correctly process newline in description text --- .../jsonSchema/impl/JsonSchemaDocumentationProvider.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java index b399cd843109..f7f022dbc1b6 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java @@ -58,8 +58,10 @@ public class JsonSchemaDocumentationProvider implements DocumentationProvider { final Collection schemas = new JsonSchemaResolver(rootSchema, true, position).resolve(); - return StringUtil.escapeXml(schemas.stream().filter(schema -> !StringUtil.isEmptyOrSpaces(schema.getDocumentation(preferShort))) - .findFirst().map(schema -> schema.getDocumentation(preferShort)).orElse(null)); + final String text = schemas.stream().filter(schema -> !StringUtil.isEmptyOrSpaces(schema.getDocumentation(preferShort))) + .findFirst().map(schema -> schema.getDocumentation(preferShort)).orElse(null); + // replace already-escaped back slash (\\n) instead of just \n + return text == null ? null : StringUtil.escapeXml(text).replace("\\n", "
"); } @Nullable