diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java index acf074915d53..08a624aa656c 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java @@ -187,7 +187,7 @@ public class JsonSchemaDocumentationProvider implements DocumentationProvider { public static String getBestDocumentation(boolean preferShort, @NotNull final JsonSchemaObject schema) { String htmlDescription = schema.getHtmlDescription(); if (htmlDescription != null && hasNonTrustedProjects()) { - htmlDescription = htmlDescription.replaceAll("]*>", "").replaceAll("", ""); + htmlDescription = cutHtmlAnchor(htmlDescription); } final String description = schema.getDescription(); final String title = schema.getTitle(); @@ -205,6 +205,16 @@ public class JsonSchemaDocumentationProvider implements DocumentationProvider { return null; } + private static @NotNull String cutHtmlAnchor(@NotNull String html) { + String current; + String next = html; + do { + current = next; + next = current.replaceAll("<\\s*a[^>]*>", "").replaceAll("<\\s*/\\s*a\\s*>", ""); + } while (!next.equals(current)); + return next; + } + private static boolean hasNonTrustedProjects() { for (Project project : ProjectManager.getInstance().getOpenProjects()) { if (!TrustedProjects.isTrusted(project)) {