Skip to content

Conversation

@victor-ikeme
Copy link

Summary

This pull request enhances the usability of multi-file examples in the Score.dev documentation hub by wrapping lengthy example-file blocks inside collapsible <details> sections.

Changes Introduced

  • Introduced reusable shortcode: layouts/shortcodes/details.html
  • Modified the following example pages:
  • examples/score/resources/community-provisioners/service.md
  • examples/score/resources/community-provisioners/dns.md
  • Wrapped each large example-file block using:
{{% details "filename.yaml" %}}
```yaml
{{% /details %}}
...content...

Style Improvements

Updated assets/scss/examples.scss with design-consistent styling for collapsible sections:

  • Support for light and dark mode
  • Subtle borders, neutral background tones
  • Rounded corners and smooth hover behavior
  • Better formatting for code blocks within collapsed sections

Motivation

Long pages containing multiple back-to-back code examples are hard to scan. This update allows readers to easily browse files by collapsing sections by default and expanding only what’s relevant to them.

Notes for Reviewers

  • The default state is collapsed
  • The filename serves as the <summary> title
  • No JS dependency introduced – purely HTML + SCSS

Related Issue

Fixes #201

What is your testing strategy?

Ran hugo server locally and tested both pages extensively, also in mobile view.

Have you read the Contributing Guidelines?

…ter UX on multi-file pages

- Introduced a reusable Hugo shortcode: layouts/shortcodes/details.html
- Wrapped long example-file blocks in collapsible <details> sections on:
  - community-provisioners/service
  - community-provisioners/dns
- Applied consistent styling in assets/scss/examples.scss:
  - Light/dark mode support
  - Soft borders, spacing, and hover effects
  - Improved code block readability inside collapses

Closes score-spec#201

Signed-off-by: Victor Ikeme <cloudikeme@gmail.com>
@victor-ikeme victor-ikeme force-pushed the fix/collapsible-code-sections branch from 387e8e6 to 0666dc2 Compare July 23, 2025 16:46
Copy link
Contributor

@mathieu-benoit mathieu-benoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, @victor-ikeme, this sounds promising!

2 feedback:

  • The ... should be removed
  • Also, around the new expandable section, we should not have the "code highlight" surrounding it:
image

I'll let you check this, but by removing anything related to border and background in the details's CSS, we can land to something like this instead:
image

One these are fixed, we'll discussed if we need to include this in the script importing the content or if we need to manually set this up.

{{% /details %}}

---
...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
...

{{% /details %}}

---
...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
...

details {
margin: 1.2rem 0;
padding: 0.6rem 1rem;
border: 1px solid #ccc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
border: 1px solid #ccc;

padding: 0.6rem 1rem;
border: 1px solid #ccc;
border-radius: 6px;
background-color: #f9f9f9;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
background-color: #f9f9f9;

cursor: pointer;
margin: -0.4rem -1rem 0.6rem -1rem;
padding: 0.6rem 1rem;
background-color: #ececec;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
background-color: #ececec;

padding: 0.6rem 1rem;
background-color: #ececec;
border-radius: 6px 6px 0 0;
transition: background-color 0.2s ease;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
transition: background-color 0.2s ease;

@victor-ikeme
Copy link
Author

Thanks for this, @victor-ikeme, this sounds promising!

2 feedback:

  • The ... should be removed
  • Also, around the new expandable section, we should not have the "code highlight" surrounding it:
image I'll let you check this, but by removing anything related to `border` and `background` in the `details`'s CSS, we can land to something like this instead: image

One these are fixed, we'll discussed if we need to include this in the script importing the content or if we need to manually set this up.

Oh ok got it ,

@mathieu-benoit
Copy link
Contributor

Hi @victor-ikeme, any updates on this one? Thanks.

@victor-ikeme
Copy link
Author

Hi @victor-ikeme, any updates on this one? Thanks.

I should get on it this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Place example code file in collapsible sections

2 participants