Conditionally Fold Headings in Publish

Use case or problem

I would like to be able to fold headings that meet certain conditions by default in my obsidian publish site. I am particularly interested in targeting headings that have a particular substring.

Proposed solution

An option in the Publish Settings interface that allows for collapsing rules for headings/indentations/lists (I personally only need headings)

Example:

Search. sensitivity (sub)string fold when
Contains case-sensitive “solution” Fold on every load
Is Exactly case-insensitive “hint” Fold on first load

For headings, if I am folding h4, I would expect all h5 and h6 would be hidden under it, until another h4 (or h1, h2, or h3) is seen.

Current workaround (optional)

Not quite a workaround, but I am able to target specific heading based on the presence of a sub-string and style them with css.
I do not have the skills to target the text AFTER the heading, specifically until there is higher-ranked heading.

Related feature requests (optional)

There are related (unanswered) help threads, but I was unable to find another thread requesting this as a feature.