Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Code Block Fold

mkalimkali21 downloads

Fold and unfold code blocks in the editor with a single click.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates1

An Obsidian plugin that lets you fold and unfold code blocks in the editor with a single click, keeping long snippets out of the way until you need them.

Demo

Features

  • Click the ▶ arrow to the left of any code block to fold it into a single preview line
  • Folded blocks show the language, first line of code, and a copy button — no need to unfold just to copy
  • Click the arrow again (or the preview line) to unfold and return to the full block
  • Fold state is saved in the file as {fold} on the opening fence, so it persists across sessions and syncs to other devices
  • Two commands for bulk operations: fold/unfold all blocks at once, or toggle the block under the cursor

Usage

Folding a block

Click the ▼ chevron that appears to the left of any code block's opening fence. The block collapses into a one-line preview:

▶  ```python  x = compute_result(data) …  [python]

Click the ▶ chevron to expand it again.

Copying without unfolding

The clipboard button on the right of a folded block copies the full block content to the clipboard without needing to unfold it first. The icon briefly changes to a checkmark to confirm.

Commands

Command Description
Toggle fold all code blocks Folds all blocks if any are open; unfolds all if all are folded
Toggle fold code block at cursor Folds or unfolds the block the cursor is currently inside

Both commands are available from the Command Palette and can be assigned a keyboard shortcut in Settings → Hotkeys.

How fold state is stored

The {fold} marker is appended to the opening fence line:

```python {fold}
x = compute_result(data)
```

This means fold state is part of the note and syncs automatically alongside your vault content.

98%
HealthExcellent
ReviewPassed
About
Fold and unfold code blocks with a single click, collapsing them into a one-line preview that shows the language, first line, and a copy button to copy the block without expanding. Save fold state inline as {fold} so it syncs with your files, and run commands to fold/unfold all blocks or toggle the block under the cursor.
CodeEditing
Details
Current version
1.0.0
Last updated
4 days ago
Created
4 days ago
Updates
1 release
Downloads
21
Compatible with
Obsidian 0.13.0+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
mkalimkalimkali-personal
GitHubmkali-personal
  1. Community
  2. Plugins
  3. Code
  4. Code Block Fold

Related plugins

Code Space

Professional code file management with visual dashboard, syntax highlighting editor, and Markdown embedding.

VSCode Editor

Edit Code Files like VSCode.

Inline Encrypter

Encrypt secrets in your notes.

Advanced Tables

Improved table navigation, formatting, and manipulation.

Templater

Create and use dynamic templates.

Outliner

Work with your lists like in Workflowy or Roam Research.

Mermaid Tools

Improved Mermaid.js experience: visual toolbar with common elements and more.

Various Complements

Complete words similar to auto-completion in an IDE.

Meta Bind

Make your notes interactive with inline input fields, metadata displays, and buttons.

Creases

Tools for effectively folding Markdown sections.