fern icon indicating copy to clipboard operation
fern copied to clipboard

Add "collapsible" (true/false) attribute to section config

Open hkosova opened this issue 1 year ago • 4 comments

Problem description

Section config in docs.yml currently supports the collapsed attribute which is very useful to manage large TOCs.

It would be great to also have the collapsible attribute so that we could create collapsible sections that are expanded by default.

Why would it be useful?

  • More consistent UX for sections - even if some sections are expanded by default, they can still be collapsed.
  • Feature parity with other documentation tools (e.g. Docusaurus).

Describe the solution (optional)

  • Sections have a boolean collapsible attribute.
  • Default value can be false to keep the current default UX.

Additional context

Screenshot 2024-11-19 at 13 11 12

hkosova avatar Nov 19 '24 10:11 hkosova

We've added support for this!

Here's the schema: https://github.com/fern-api/fern/blob/537bc7609f04730962c02c733889cd25ff821e2c/fern/apis/docs-yml/definition/docs.yml#L584

Example: https://github.com/octoml/fern-config/blob/df167d25518348e615c4f6b821ad0f3c75214616/fern/docs.yml#L216-L217

dannysheridan avatar Mar 03 '25 21:03 dannysheridan

We've added support for this!

Here's the schema:

fern/fern/apis/docs-yml/definition/docs.yml

Line 584 in 537bc76

collapsed: optional

Example: https://github.com/octoml/fern-config/blob/df167d25518348e615c4f6b821ad0f3c75214616/fern/docs.yml#L216-L217

@dannysheridan this request is slightly different. It's about having top-level sections that are both A) collapsible/expandable and B) expanded by default.

Something like:

- section: Introduction
  collapsible: true  # new config to be added, controls whether this section
                     # is rendered with the ">" (expand) / "^" (collapse) buttons
  collapsed: false
Screenshot 2024-11-19 at 13 11 12



Currently top-level sections can be either

  • non-collapsible, always expanded
  • collapsible and collapsed by default

but not

  • collapsible and expanded by default <-- what we need

hkosova avatar Mar 14 '25 14:03 hkosova

does collapsed: false work even on the subsections like you've said @dannysheridan ? Our impression is that this does not work.

jordn avatar Mar 17 '25 15:03 jordn

@abvthecity has someone tested that his works?? This feels like a really simple fix, that really effects the docs quality

jordn avatar Apr 08 '25 17:04 jordn

Since this now works, closing!

dsinghvi avatar Jun 24 '25 02:06 dsinghvi