Coder Social home page Coder Social logo

liamcain / obsidian-creases Goto Github PK

View Code? Open in Web Editor NEW
220.0 4.0 6.0 2.76 MB

๐Ÿ‘• Tools for effectively folding markdown sections in Obsidian

License: MIT License

JavaScript 7.45% TypeScript 91.84% CSS 0.70%
obsidian-md obsidian-plugin

obsidian-creases's Introduction

Creases ๐Ÿ‘•

Tools for efficiently folding markdown sections in Obsidian.

creases-overview

Add %% fold %% markers to "crease" your markdown. Then run Fold along creases to get your file into the state you want.

โš™๏ธ Commands

General Folding

  • Fold headings by level โ€“ Fold all headings in the correct document that match a given level (H1 - H6)
  • Fold More - Finds and folds the closest heading or list item.
  • Fold less - Finds and unfolds the closest heading or list item.

Fold Levels

Creases also borrows the concept of a "fold level" from vim. The fold level is inferred from the current folds in the note. If have you have your ## Heading Level 2 headings folded, decreasing the fold level will unfold all headings up to # Heading Level 1. Increasing the fold level will unfold up to your ### Heading Level 3.

  • Increase heading fold level - Increase the fold level by 1
  • Decrease heading fold level - Decrease the fold level by 1

Working with "creases"

  • Toggle Crease โ€“ Crease/uncrease the current section that you're in
  • Crease the current folds โ€“ Applies a crease to the current folds in the file, allowing you to easily get back to these current folds using fold along creases.
  • Fold along creases โ€“ Fold all the creased sections of your file
  • Iron out the creases โ€“ Remove all the creases from the current file

โž• Additional Features

  • Templates support โ€“ If you use the Templates core plugin, any creases included in your template will automatically be folded.
  • Templater support โ€“ Add creases to your Templater templates to have content automatically folded.

โšก๏ธ Example Workflows (aka "Has this ever happened to you?")

Create a "save state" for your folds

If you're working on a long document, you might find yourself folding sections as you go. Now you want to do a "Find" in the fold. Uh oh, it found a match but now all your folded away content is unfolded.

Instead, save your folds as creases:

  1. Run "Crease the current folds" to mark all your current folds as creased.
  2. Search the document to your heart's content, unfolding without a care in the world.
  3. Run "Fold along creases" to restore all your folds to exactly how they were before.
  4. Optional Now that you're back to your ideal document origami, you can run "Iron out the creases" to get rid of the fold markers.

You want content in your template to be folded by default.

Whether you use the core Templates plugin or Templater, you might find yourself wishing that some sections start folded since you don't look at them often.

  1. In your template file, just make sure that %% fold %% appears on the same line as the heading or list item that you want folded. You can also run the "Toggle crease" command from within the template to insert the crease automatically.

You want to fold all the ### Level 3 Headings in your document

Folding all the headings at a given depth can be a tedious process. Well, no longer.

  1. Just run "Toggle fold for H3."

๐ŸŽž Credits

Special thanks @mleo2003 on Discord for the plugin name.

Say Thanks ๐Ÿ™

If you like this plugin and would like to buy me a coffee, you can!

BuyMeACoffee

Like my work and want to see more like it? You can sponsor me.

GitHub Sponsors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.