theme: Display short command on commands list

This commit is contained in:
Joe Mooring
2025-02-12 13:56:58 -08:00
committed by Bjørn Erik Pedersen
parent 7f81dd9972
commit 9630c38cb8
+6 -1
View File
@@ -49,7 +49,12 @@
{{ end }}
<p
class="text-black dark:text-gray-100 leading-6 text-sm md:text-base three-lines-ellipsis">
{{ (or .Params.description .Summary) | plainify | safeHTML }}
{{ if and (eq .Section "commands") .IsPage }}
{{ $simpleCobraCommandShort := .RawContent | strings.ReplaceRE `(?s)^##\s.+?\n\n(.+?)\n\n.*` "$1" }}
{{ printf "%s." $simpleCobraCommandShort }}
{{ else }}
{{ (or .Params.description .Summary) | plainify | safeHTML }}
{{ end }}
</p>
</a>
{{ end }}