Adding tags/keywords to blocks of text

This request is a bit long - so please be patient. I am not even sure if Obsidian is the right tool for my task/project (I am quite new to Obsidian). Any pointers/tips/tricks would be greatly appreciated!

The background: I have thousands of pages of transcribed conversations with questions and answers that span a number of different topics. These conversations are spred in numerous Word files. Importing them into Obsidian is not a issue - it works great. Just a bit of work. Each conversation spans 10-60 pages (A4) and I want to preserve the whole conversation in separate notes.

The problem I want to solve: I want to be able to do more than just “word search”. I want to be able to “tag” or “mark” a section of a conversation with one or more keywords, even if the keyword are not mentioned in the conversation. For example, a conversation about the topic “cancer” might not mention the word “cancer” and would not get a word search hit.

Since each conversation has a date, I would also like to search by date. For example: Show any conversation(s) that discussed the topic “cancer” in 2020.

If I understand tags correctly, they are meant for a note or a line, and using it for anything in between is considered “messy”. I would need to tag a block of text (multiple lines) with one or more keywords.

My goals:

  1. First and foremost to have a library of conversations easily searchable in my own Obsidian vault.
  2. Create different “topic pages” for all blocks of text that mention a specific topic. Example: One page showing all excerpts of a conversation that discuss “cancer”.
  3. My end goal is to export my vault to the web, and make all the conversations easily searchable for others.

Example of a conversation document:
Q: A question related to cancer. A: Answer the question about cancer. Q: Follow-up question about cancer. A: More detailed answers about cancer.
Date: DD-MM-YYY

Q: A question about migraines. A: An answer about migraine
Date: DD-MM-YYYY

Q: A question about medication. A: Answer about medication. Q: Questions about medicine related to cancer. A: Long detailed answer about medicines related to cancer.
Date: DD-MM-YYYY

Q: Questions about hospitals and doctors.
A: Answer about hospital.
Q: What about doctors?
A: Answer about doctors.
Date: DD-MM-YYYY
etc. etc.

Questions:

  1. How can I tag/mark blocks of text for one or more topics and the date?

  2. When I have tagged/marked all the different parts of all the conversations, how can I create a “keyword page”?

  3. Is there a way to make export my vault to the web with this search functionality? (The first two questions are the most pressing to solve as of now - publishing to web can come later)

Many thanks!

How important is this goal? You cannot query text blocks in Obsidian (natively without using community plugins). The search results are always full notes. However it would require you to use custom syntax anyway to denote these text blocks. This requires a lot of work and doesn’t necessarily pay off. You would generally want to pay someone to do that kind of work. The exact syntax used is not important here provided that this syntax is consistent. Pandoc’s markdown offers fenced divs and bracketed spans which can take class and key–value attributes. You can use Pandoc Lua Filters to extract specified block-elements from documents. You can embed shell scripts in Obsidian using Execute Code community plugin. The big question remains that using any custom syntax to denote your text blocks will require a lot of work. Other Obsidian equivalent for that work is using Note composer to extract selected text to new notes. By using notes to denote your content, properties can be then used to classify that information.

Take a look at how Dataview works with inline fields. This might be a more robust solution than tagging.

1 Like

In each block, add a link (i.e. [[cancer]]) then create a note called cancer. I usually place this at the end of the last sentence in a block.

If you look down at the bottom of the cancer note in Linked Mentions you’ll see each of the blocks.

You can further filter that list by clicking on the magnifying glass and filter by, say, folder or a text phrase (i.e. “prostrate”) and that will filter to just those notes containing blocks with the link of [[cancer]] and also the occurance of the word “prostrate”.

This is built into Obsidian.

Let us know how you solve this. Cheers!

You can search by block in core search - block:(indole) for example.

Thanks. I tested this and it works although usecases can be hard find. Usually paragraphs are written to one line but this allows to add extra keywords below paragraphs to be used in search queries block:(keyword my-search). Other example is tables and codeblocks:

search query1: block:(line1 line2)
search query2: line:(line1 line2)

| line1 |     |
| ----- | --- |
| line2 |     |

```
line1
line2
```

Thanks! Looks like fenced divs/bracketed spans (or any equivalent) might work, but will require a bit of work as you say @blue_emperor.

Will take a closer look at Dataview with inline fields (thanks @RoyRogers). Perhaps in addition or combination with your suggestions @writtenfool? I’ll test them out.

I have also found the plugin “tag-summary” which might do (kindof) what I want.

Again, many thanks for your answers! If you have any additional tips/tricks to share it is much appreciated!

1 Like