Skip to content

Fold (Collapsible Sections) ​

Use a fold to show a summary above collapsible details. The reader opens the summary to show the details.

Basic Fold ​

sevenmark
{{{#fold
[[Summary text]]
[[Hidden detailed content]]
}}}

The first [[]] block is the summary (always visible), and the second [[]] block is the detail content (collapsed by default).

Both parts are structural double-bracket segments. The parser matches balanced [[...]], [...], and {{{...}}} regions while looking for each segment's close, then parses the segment bodies as nested SevenMark content.

Namumark Folding Blocks ​

SevenMark also accepts namumark-style folding blocks:

sevenmark
{{{#!folding Summary text
Hidden detailed content.

It can contain nested SevenMark blocks.
}}}

The title on the opening line becomes the fold summary, and the block body becomes the fold details.

Fold Structure ​

Folds use a two-part structure:

  1. Summary (first [[]]): Always visible, clickable to toggle
  2. Detail (second [[]]): Hidden by default, revealed when summary is clicked
sevenmark
{{{#fold
[[Click to expand]]
[[
This content is hidden until the user clicks the summary.
It can contain multiple lines and any SevenMark elements.
]]
}}}

Styled Folds ​

Apply styling using parameters:

sevenmark
{{{#fold #style="border: 1px solid #ccc; padding: 10px"
[[Custom styled fold]]
[[Hidden content with styling]]
}}}

{{{#fold #color="blue" #bgcolor="#f0f8ff"
[[Colored fold summary]]
[[Colored detail content]]
}}}

Folds with Rich Content ​

Code in Folds ​

sevenmark
{{{#fold
[[View Code Example]]
[[
``` #lang="rust"
fn main() {
    println!("Hello from collapsed code!");
}
```
]]
}}}

Lists in Folds ​

sevenmark
{{{#fold
[[Show Feature List]]
[[
{{{#list #type="numeric"
[[Feature 1: Fast parsing]]
[[Feature 2: AST serialization]]
[[Feature 3: Extensible architecture]]
}}}
]]
}}}

Tables in Folds ​

sevenmark
{{{#fold
[[Show Comparison Table]]
[[
{{{#table
[[[[Feature]] [[Basic]] [[Premium]]]]
[[[[Storage]] [[1GB]] [[100GB]]]]
[[[[Support]] [[Email]] [[24/7]]]]
}}}
]]
}}}

Nested Folds ​

Folds can be nested inside other folds:

sevenmark
{{{#fold
[[Level 1: Main Topic]]
[[
Content for main topic.

{{{#fold
[[Level 2: Subtopic]]
[[
Nested content here.

{{{#fold
[[Level 3: Details]]
[[Deeply nested content]]
}}}
]]
}}}
]]
}}}

Common Use Cases ​

Documentation Sections ​

sevenmark
{{{#fold
[[Advanced Configuration]]
[[
For power users, the following advanced options are available:

``` #lang="yaml"
advanced:
  cache_size: 1000
  optimization_level: 3
  debug_mode: false
```
]]
}}}

FAQ Items ​

sevenmark
{{{#fold
[[How do I start the local renderer?]]
[[
From the repository root, run:

``` #lang="bash"
cargo run -p sevenmark_server
```

For configuration and deployment steps, see the repository README.
]]
}}}

{{{#fold
[[What languages are supported?]]
[[
SevenMark supports code highlighting for:
- Rust, Python, JavaScript
- Go, Java, C++
- And many more!
]]
}}}

Spoiler Content ​

sevenmark
{{{#fold #style="background: #f0f0f0; padding: 5px"
[[Spoiler Warning]]
[[
The main character was the villain all along!
]]
}}}

Styling Options ​

Use these shared style parameters:

  • #style - Custom CSS styling
  • #color - Text color
  • #bgcolor - Background color
  • #size - Font size
  • #opacity - Opacity level
sevenmark
{{{#fold #style="border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1)"
[[Beautifully Styled Fold]]
[[Content with custom styling applied]]
}}}

Technical Notes ​

  • Folds require exactly two [[]] blocks: summary and detail
  • The first block is the summary, the second is the detail content
  • Detail content can contain any SevenMark elements
  • Structural segment bodies are trimmed at their boundaries before nested parsing
  • Nested folds are subject to the parser's recursion limit
  • Parameters apply to the fold container