Is it possible to tag a block?

When taking daily notes, I tag important lines so that I can query them later (under construction :))

feed the cat

make sure to buy beer #important

Socrates once told that $E=mc^2$

It will (hopefully) work fine for single lines such as the example above, but I would like to extend that to multiline text, something like

feed the cat

#work --
We need to upgrade the appliance on the second floor, careful with the passwords #todo
John and Mary gathered requirements for the network in the new facility
buy beer for work
--

Socrates finally did not say anything about $E$.

The idea would be to have everything between #work -- and -- (this is just an invented way to do that - anything will be fine) tagged with #work so that I can query the block the same way as single lines.

The ultimate goal being to have a page with everything #work related.

I am ready to jump into coding, just knowing whether

  • this is already available by plugin XXX :face_holding_back_tears:
  • this is possible by doing YYY :+1:
  • this is not possible because of how Obsidian works :weary:
2 Likes

If I understand what you’re looking for, this is already possible in Obsidian.

A multiline text block takes up multiple lines visually, but it’s still one line from Obsidian’s point of view. You can add a tag to the end of it and Obsidian will treat the whole block the same way as a line.

Here’s an example using Obsidian’s built-in query feature. The “Report” page below has this as its source:

```query
#work
```

2 Likes

Thank you for your answer. I think however that you are referring to a single line that warps:

A very long line that warps.A very long line that warps.A very long line that warps.A very long line that warps.A very long line that warps.A very long line that warps.A very long line that warps.A very long line that warps. #one

A multiline block where the line ends with a CRLF
And the second line of the block, also ends with CRLF
A third one #two

A line from a "block" that is a paragraph (ends with CRLF CRLF)

The second line from the "block" above, but there is no indicator of them being linked

A third one like the one above #three
  • Would the second case be treated as a single block? (that would be fine)
  • I guess that the third case is not doable (the advantage is it would bring in paragraph formatting, headers, etc.)

EDIT:

I tried the second case and it seems not to work, unfortunately (only the actually tagged line is taken into account)

Yes, you’re right: my suggestion applies to long wrapped single lines, not blocks that contain newlines. In both of the other cases, the tag would only be associated with the line on which it appeared. Thanks for the clarification.

In Obsidian, tags are associated with data at two levels: the page on which the tag appears and the individual lines of a page on which the tag appears.

Since you’re querying individual lines of your daily notes, and you’re mixing lines that have different contexts, you have to tag each line with the contexts in which you want to see it. In particular, you would need to append #work to each line that you want to see when querying for work lines.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.