zonvon25 downloadsFold name[options] inside code blocks into a clickable tag, or show the options and comments in a hover popup.
English | 简体中文
Fold a long name[options] inside a code block into one clickable tag — expand it when you need the
details, or switch to a hover popup that lists every option together with its comment.
It is built for anything shaped like a name plus a long list of accepted values: shader properties,
engine settings, CLI flags, enum values — as long as you can write it as name[content].
Repository: https://github.com/zhongxiaguchen/code-block-context-fold · Latest: 3.4.2
Cull 选项[back/Front/Off] collapses to an underlined Cull 选项; click to expand, click again to collapse.Cull 选项 ▾ pill; hover to list the options, hover an option to see its comment.manifest.json, main.js and styles.css from
Releases
(or grab code-block-context-fold-3.4.2.zip and unzip it).<your vault>/.obsidian/plugins/code-block-context-fold/.The plugin is not tied to any vault: each vault keeps its own fold data.
node scripts/deploy.mjs --vault "/path/to/vault"
Copies the three build outputs only; your vault's data.json is left untouched.
Select a complete name[content] inside a code block — multi-line selections and nested brackets both
work — then right-click → the fold command, or use the command palette.
text).The generated text looks like this:
混合模式[
Normal//正常混合
Add//相加,越高越亮
]
// is a comment.=, + and so on are all fine.Right-click a tag → switch between plain fold and options popup. Switching only changes the rendering; your note text is never modified.
Settings → Community plugins → this plugin:
The overview is also available from the ribbon icon and from the command palette.
No network access, no telemetry, no analytics. The plugin does exactly two things: it reads notes from your vault, and it writes fold positions to a local JSON file.
Fold records live in .obsidian/plugins/code-block-context-fold/data.json:
.gitignore. Do not commit or share it.[ ] are structural and cannot appear in parameter names, option values, or comments.isDesktopOnly: true.Requires Node.js ≥ 22.8.
npm run build # zero-dependency bundle: src/ → main.js
npm run build:esbuild # bundle with esbuild (after npm i)
npm test # unit tests (Node's built-in runner)
npm run release # validate + build + test + zip
npm run build uses scripts/build.mjs, a small bundler that only inlines relative require calls,
so a fresh clone builds without installing anything. obsidian and @codemirror/* always stay
external and are provided by the Obsidian runtime.
src/
main.js lifecycle, context menus, commands, data IO
state.js shared plugin instance and right-click context
editor/blocks.js code fence scanning
editor/selection.js selection → fold region
editor/anchor.js anchor capture
editor/recover.js relocating folds after edits
editor/decorations.js CodeMirror StateField, decorations, mouse handling
editor/text-range.js range lookup across text nodes (reading view)
reading/source.js source snapshot and anchor projection for reading view
reading/render.js fold rendering in reading view / export
format/parameters.js parse and serialize parameter expressions
settings/defaults.js default settings and normalization
settings/overview.js data projection for the overview
ui/options-dom.js pill and hover panel DOM (shared by editor and reading view)
ui/options-widget.js CodeMirror widget wrapper
ui/setup-modal.js option editor form
ui/settings-tab.js settings page
ui/overview-modal.js fold overview
util/{id,text}.js small helpers
scripts/
build.mjs zero-dependency bundler
deploy.mjs install into any vault
migrate-legacy-format.mjs one-off migration from the 2.x format
release.mjs validation + zip
test/ unit tests
docs/ README images and recording guide
.github/workflows/ builds and publishes on tag push
main.js build output (committed for direct install)
See RELEASING.md. The short version:
version in manifest.json and package.json, and add an entry to versions.json.npm run release.git tag <version> (no v prefix) and push.manifest.json, main.js, styles.css and the zip attached.Pushing the tag makes .github/workflows/release.yml build and publish the release automatically.
GPL-3.0-or-later — see LICENSE.
Copyright (C) 2026 Zonvon