score-spec / score-spec/docs

Place example code file in collapsible sections

Open
#201 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation enhancement
Dominant language
HTML
Stars
7
Forks
25
Avg merge
4d 5h
Merged PRs (30d)
3

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:

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 %}}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the example pages for service and DNS, then trace how multiple example code files are rendered. The issue suggests starting with layouts/shortcodes/details.html and the provided details shortcode. Done means each back-to-back file appears in its own collapsed section titled with the filename, with all sections collapsed by default.

Written by the indexing model from the issue text.

Assessment

Tech stack
hugo
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.