From 16fb8510dba9943dd062d42c12ea44525cc5ea9f Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Mon, 12 Oct 2020 11:31:36 +0200 Subject: Shorten anchors --- plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'plugins/base/src/main/kotlin') diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 8f6129a6..31a96110 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -849,8 +849,13 @@ val ContentNode.isAnchorable: Boolean val ContentNode.anchorLabel: String? get() = extra[SymbolAnchorHint]?.anchorName +/** + * Anchors should be unique and should contain sourcesets, dri and contentKind. + * The idea is to make them as short as possible and just use a hashCode from sourcesets in order to match the + * 2040 characters limit + */ val ContentNode.anchor: String? - get() = extra[SymbolAnchorHint]?.contentKind?.let { contentKind -> (dci.dri.first().toString() + "/" + contentKind + "/" + sourceSets.joinToString { it.sourceSetIDs.all.joinToString() }).urlEncoded() } + get() = extra[SymbolAnchorHint]?.contentKind?.let { contentKind -> (dci.dri.first().toString() + "/" + contentKind + "/" + sourceSets.hashCode()).urlEncoded() } val ContentNode.sourceSetsFilters: String get() = sourceSets.sourceSetIDs.joinToString(" ") { it.toString() } -- cgit