From 003e3b828aa59035ae339fdf12c5ecc89cb99f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 24 Apr 2024 16:58:28 +0200 Subject: [PATCH] Add anchors in definition shortcode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- layouts/shortcodes/definition.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/layouts/shortcodes/definition.html b/layouts/shortcodes/definition.html index 23461878..a1f0904e 100644 --- a/layouts/shortcodes/definition.html +++ b/layouts/shortcodes/definition.html @@ -26,7 +26,9 @@ {{ $definition = partial "json-schema/resolve-refs" (dict "schema" $definition "path" $path) }} {{ $definition = partial "json-schema/resolve-allof" $definition }} -
+{{ $anchor_base := printf "definition-%s" (anchorize $definition.title) }} + +
@@ -46,7 +48,11 @@ {{ $definition.description | markdownify }} -{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $definition "name" (printf "\"%s\"" $path)) }} +{{ $additional_types := partial "json-schema/resolve-additional-types" (dict + "schema" $definition + "anchor_base" $anchor_base + "name" (printf "\"%s\"" $path)) +}} {{ range $additional_types }} {{ partial "openapi/render-object-table" . }}