# Add a maximum nesting depth for collapsible details

**URL:** <https://meta.discourse.org/t/add-a-maximum-nesting-depth-for-collapsible-details/414455>\
**Category:** Feature\
**Tags:** hide-details\
**Created:** [October 11, 2026, 5:20am UTC](https://meta.discourse.org/t/add-a-maximum-nesting-depth-for-collapsible-details/414455 "2026-10-11T05:20:13Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![scavin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scavin/32/115938_2.png) [@scavin](https://meta.discourse.org/u/scavin)\
**Post date:** [October 11, 2026, 5:20am UTC](https://meta.discourse.org/t/add-a-maximum-nesting-depth-for-collapsible-details/414455/1 "2026-10-11T05:20:13Z")

</div>

I’d like to suggest adding a maximum nesting depth for the built-in `[details]` feature, or introducing a site setting that allows administrators to configure this limit.

#### The problem

Recently, a user on my Discourse forum created a post containing **24 levels of nested `[details]` sections**.

This caused several problems:

1. **Browser performance:** Users reported that expanding multiple levels caused Firefox to become extremely slow or unresponsive.
2. **Markdown endpoint timeouts:** Accessing the topic’s `.md` endpoint became extremely slow. We observed requests taking **19.8 seconds and 31.1 seconds**.
3. **Server errors:** The Markdown endpoint sometimes returned an “Oops” error page. The Discourse logs also showed Pitchfork worker timeout warnings during Markdown conversion.
4. **Potential resource exhaustion:** Since search engines and AI crawlers frequently request `.md` endpoints, a deeply nested post could repeatedly trigger expensive processing and consume server resources.

After removing the problematic post, the Markdown endpoint returned HTTP 200 and responded in approximately **1.7 seconds**.

The affected topic was:

[https://meta.appinn.net/t/topic/87672](https://meta.appinn.net/t/topic/87672)

 ![screenshot-2026-10-11 at 1.19.11 PM@2x](https://global.discourse-cdn.com/meta/original/4X/3/e/9/3e9e969f7e858ae6c020c88f256a4e9b763da6df.png)

(The problematic reply has already been removed.)

#### Suggested improvement

I think it would be useful to either:

- Limit `[details]` nesting to a reasonable depth, such as 2 or 3 levels.
- Add a site setting, such as `details_max_nesting_depth`, allowing administrators to configure the maximum nesting depth.

For backward compatibility, the setting could default to unlimited, while allowing administrators to enforce a limit when needed.

If users exceed the configured limit, Discourse could reject the post with a clear validation message.

#### Temporary workaround: a plugin

I’ve created a small plugin that limits `[details]` nesting to a maximum of **2 levels** :

**[GitHub - scavin/discourse-details-depth-limit · GitHub](https://github.com/scavin/discourse-details-depth-limit/)**

The plugin validates posts on the server side and rejects posts containing more than two levels of nested collapsible sections.

I’ve tested it successfully in my local Discourse development environment.

For administrators experiencing similar issues, this plugin may serve as a temporary workaround until an official solution becomes available.

I believe a configurable limit in the built-in Details plugin would be a useful safeguard against accidental or excessive nesting.

---

_[View the full topic](https://meta.discourse.org/t/add-a-maximum-nesting-depth-for-collapsible-details/414455)._
