Is it possible to tag mulitple lines of text with a category

What I’m trying to do

I’m just learning the power of "query " and want to use it to dynamically display multiples lines of a note that have the same tab.

I started with Quotes by added “#quote” to the end of the line and then querying for that.

Now I’m trying to do jokes, which often have a setup line and a punch line.

example

Buy a man an plane ticket, he will fly for a day
Throw a man from a plane, he will fly for the rest of his life

This is 2 lines. If put “#joke” on the second line and run a query, I get back only that line.

What I’d like to do is get back both lines. While I have started with using tags to accomplish my goal, I’m ok with using another tool, say dataview, if that would do what I want.

Thanks in advance.

Using your example:

Buy a man an plane ticket, he will fly for a day  
Throw a man from a plane, he will fly for the rest of his life #quote

and a query with the regex of:

```query
/(?:^(.*)\n)?^(.*#quote.*)/
```

seems to return what you are looking for. The query header is a bit ugly, but it works.


Query Control, a beta plugin, lets you customize the header among other things.

e.g.

```query
title: A ticket to fly...
/(?:^(.*)\n)?^(.*#quote.*)/
```

1 Like

Is the general solution? 2 lines was just an example. It could be any number of lines.

For quotes, I create a note file name with the quoted persons name ( e.g. Steve Jobs Quotes.md) and put all of his quotes in there. I have many of these files. If I can tag multiple lines as a “group” then the query can return all of the quotes from these notes.

Now, I’ve already thought about adding additional tags so that I can organize the quotes better.

For example I might take a quote like “The Force Will Be with You - Obiwan Kenobi” and add #quote #star-wars to it , so that I can search for just Star Wars quotes or for Obiwan Kenobi quotes.

Without giving an exact coding, you might consider looking into the various spoiler plugins which would allow to to hide the punch lines.

Another option with similar effect is using callouts, where I’m thinking one outer callout fire the entire joke and optionally a callout which is closed by default for any punch line you want hidden at start.

The latter could possibly be queried, at least through searches, and you could tag the outer callout.

If you wanted to venture into dataview queries I would consider using item or task lists with sub list. Then a query could get the main item off the n joke, and display the children to present the entire joke.