-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Is your feature request related to a problem? Please describe.
Some examples in the Score example hub contain several example files which are shown inline one after another. Due to some of them being rather extensive, this makes it somewhat difficult to navigate the page and see what's available on it.
E.g. here:
- Multiple Score files: https://docs.score.dev/examples/score/resources/community-provisioners/service/
- Multiple code examples: https://docs.score.dev/examples/score/resources/community-provisioners/dns/
Describe the solution you'd like
Enhance the page rendering so that any time more than one example code file is being shown back to back, all of them are placed in a collapsible section for each file. The section has the name of the file as its title.
By default, i.e. when the page is opened, all sections are collapsed.
Additional context
This Hugo shortcode may serve as a starting point:
<details{{ with .Get 1 }} {{ . | safeHTML }}{{ end -}}>
<summary>{{ with .Get 0 -}}{{ . | safeHTML }}{{ else -}}{{ errorf "No summary provided"}}{{ end -}}</summary>
{{ with .Inner -}}{{ . | markdownify}}{{ else -}}{{ errorf "No details provided"}}{{ end -}}
</details>
When placed in layouts/shortcodes/details.html
, it can then be used on a page like this:
{{% details "the section title goes here" %}}
... some content
{{% /details %}}