bwya776k downloadsMakes code blocks collapsible in preview mode as well as enabling scroll-able code blocks.
Make code blocks collapsible in preview mode with customizable collapse/expand behavior and horizontal scrolling options. This plugin enhances the readability of your notes by allowing you to collapse long code blocks when you don't need to see their full content.
collapsed or expanded in the frontmatterOnce installed, code blocks in preview mode will automatically have a toggle button in their top-left corner. You can:
The plugin offers several customization options:
Set a note to always have code blocks expanded or collapsed by default by adding the following to the note's frontmatter (note: this will override the global default setting):
code-blocks: collapsed
code-blocks: expanded

Here's how a code block appears with the plugin enabled and the code block expanded:
Here's how a code block appears with the code collapsed and set to show 0 lines.
If you encounter any issues or have suggestions:
Want to contribute? Here's how to get started:
Clone the repository:
git clone https://github.com/bwya77/collapsible-code-blocks.git
Install dependencies:
npm install
Start development build:
npm run dev
.obsidian/plugins/ directory