Expand/Collapse inline text

Is there a way to Expand/Collapse text inline within a sentence?

There’s no expanding/collapsing functionality at all – at least not currently. You can only fold lists or headings in Obsidian.

solution / workaround using html and css:

Example from answer in html - Expand text in line - Stack Overflow
pasted into Obsidian (0.9.22) works in preview, collapsed by default.

Here are a few words on my thought about the movie <details><summary>Deadpool</summary> it was so well shot and a movie I just can't wait to see again.</details>

But it displays as multi-line. With CSS it can display inline until expansion:

start <details style="display: inline;"><summary>hint</summary>verification</details> end

This displays inline in Obsidian

but not here on forum.


This is potentially useful for implementation of:

keywords: answer, cloze deletion, collapse, flashcards, fold, hide, learning, question, recall, study, test

1 Like

I’m extremely interested in expanding on this specifically to support spaced repetition directly within Obsidian. Both I and a family member will be resuming studies soon and this can be a powerful addition to our study notes.

One problem though is that Obsidian does not expand its syntax inside the HTML elements. For example, **foo** and ![[image.png]] displays exactly as shown here. You can use <b>foo</b> but embedding images in theory requires using the file:// URI format which can only reference absolute file paths (not relative from the vault root) and which for some reason I’m currently unable to use properly on Mac.

Just imagine creating study notes that have question/response with the question showing an image and asking a brief question about it then the response being expanded to show additional images and several lines of text explaining it and linking to other notes/external resources.

As someone who previously used several spaced repetition systems including very powerful ones I cannot stress how much of a game changer this capability can be if it is properly supported.


This works most of the time. As far as I can remember, WhiteNoise or someone mentioned that this feature is “inherit” from upstream in some other topics. So it is not guaranteed to work all the time. Specific for Obsidian, some content will break this tag (maybe having HTML tags such as <table>? Or having too many LaTex equations?). I’m pretty sure I had some broken “folded content” when I moved my notes from another MD notebook to Obsidian. I can take a quick look at my notebook, find out error cases if anyone is interested in.

A general limitation with obsidian which it inherits from markdown is that all content of a node in the document must precede the children.

I sometimes want to do something like this (which is kinda what the OP wants):

# Section

... some introduction ...
which lead us to "Details":

## Details [
... the details

... main explanation continues

I know I can use links and move the “Details” section to after all the main content, but sometimes the “inline” child node feels much more natural.