From 44faefc35d6f0894e6e8b213780bc3cad15772ff Mon Sep 17 00:00:00 2001 From: titusfortner Date: Fri, 18 Apr 2025 10:44:26 -0700 Subject: [PATCH] add details tag with full example to code snippets --- .../layouts/shortcodes/gh-codeblock.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/website_and_docs/layouts/shortcodes/gh-codeblock.html b/website_and_docs/layouts/shortcodes/gh-codeblock.html index ca3073301620..ff7ce8e2ce88 100644 --- a/website_and_docs/layouts/shortcodes/gh-codeblock.html +++ b/website_and_docs/layouts/shortcodes/gh-codeblock.html @@ -21,6 +21,7 @@ {{ $fullPath := .Get "path" }} {{ $path := index (split $fullPath "#") 0 }} +{{ $hasFragment := in $fullPath "#" }} {{ $apiUrl := printf "%s/%s/%s/contents%s?ref=%s" $apiBaseUrl $org $repo $path $branch }} {{ $webUrl := printf "%s/%s/%s/blob/%s/%s" $webBaseUrl $org $repo $branch $fullPath }} @@ -50,6 +51,13 @@ {{ highlight $codeSnippet $language }} +{{ if $hasFragment }} +
+ Show full example +
{{ highlight $content $language }}
+
+{{ end }} +
@@ -58,6 +66,4 @@
{{ else }} {{ partial "github-content.html" }} -{{ end }} - - +{{ end }} \ No newline at end of file