Collapse inline text

Use case or problem

I have some text I want to collapse because it’s not essential to the main purpose of what I’m writing.

I use Obsidian to get my thoughts out. Sometimes they come out in a stream of consciousness with many tangents. Then I try to make sense of what I’ve written. If the stream gets too long, it becomes difficult to make sense of. Being able to collapse inline text would help me selectively hide irrelevant tangents so I can focus on what is relevant. At the same time, the stream remains intact so none of the information becomes lost or difficult to access.

Proposed solution

Some simple markdown and/or editor command that collapses inline text to something unobtrusive like “[…]” or, optionally, a summary title like “[ramble]” or “[tangent]”. It can be clicked to display the text. In the expanded view, a clickable “…” icon would allow me to hide the text again.

Current workaround (optional)

The closest workaround is inline footnotes. I can toggle between showing and hiding the text by switching between Reading View and Live Preview. This is very close to the functionality I want. But I can’t edit any of my writing in Reading View, only in Live Preview where all of the irrelevant text is displayed.

Another approach is collapsible headings and callouts. But they require breaking text out into blocks or sections, which drastically changes the semantics of the writing. In fact, it’s semantically the opposite: calling more attention to the hidden text rather than less.

There’s also the details/summary html tags. But I couldn’t get them to work in a satisfactory (inline) manner. Besides, typing all that html is too disruptive for this purpose.

Related feature requests (optional)

Collapsable block of text?

Expand/Collapse inline text

Not a solution, but another workaround, but inline!

image

I have a CSS snippet …

.hide {
  background-color: #363636;
  color: #363636;
  border-radius: 4px;
}
.hide:hover {
  background-color: inherit;
  color: inherit;
}

… which hides SPAN with a class hide. And unhide it when hovering the mouse over it. Works in editing and reading mode.

And I assign a keybind to insert it. As I said, not a solution, just an idea to use before FR is implemented :wink:

Cheers, Marko :nerd_face:

The simplest way:

Text %%hidden text%% text

Works also on multiple lines. Therefore, add percent at the top/bottom respectively

Interesting workaround! Took me on a whole odyssey of adding snippets on my iPad, then the whole curly quotes/straight quotes debacle, but I finally got it to work.

Thank you. This will be my workaround for now.

I like the simplicity of Jopp’s workaround. (Note that to hide the text you switch to reading view.)

Some more workarounds:

  • Indent the text by 1–3 spaces, making it foldable under the preceding text (only works in editing view).
  • Add a heading, then fold it (can be empty if you only need it in editing view).
  • Add list markers to the text and the text (or empty line) before it, indent the text, and fold the text above it.
  • The Creases plugin.

Thanks for the ideas!