silverbulletmd / silverbullet

The hackable notebook
https://silverbullet.md
MIT License
2.03k stars 140 forks source link

Tags aren't rendered in Paragraphs section of tag summary page #845

Open Terrance opened 2 months ago

Terrance commented 2 months ago

Given the following page content:

#test

This is a #test tag.

The "📌 test" page looks like this:

image

Note that the tag itself is missing from the quoted paragraph. If a paragraph includes multiple tags, they're all missing (i.e. it affects both the tag of the summary page you're looking at, as well as other nearby tags).

zefhemel commented 2 months ago

Yeah, this is a good point that requires some type of decision.

In general you may use a hashtag "in the flow" of some text, like you're doing now. In others you may use it to tag something more as meta data. Likely in those scenarios you'd put the hash tag either at the very beginning or very end, so we could make the behavior of whether to leave the tag inside or not depend on that. That may lead to unexpected edge cases, though. For instance if your paragraph (in this case, but we should the same rules apply to pages, items, tasks etc.) starts with a hashtag it would disappear, whereas if it's the second word it is not. An alternative would be to keep two versions in the database, one with all tags in tact and one without.

Opinions?

Maarrk commented 2 months ago

I'd try to not introduce special behaviour with surprising edge cases in the default application. Also keeping the same information twice seems like it will need to be maintained twice, cause surprises for Plugs etc.

In that case of choosing just one, I'd show the tags, mostly because it supports the IMO simpler and "mainstream" use case of using them in text. In the other situation of having them as metadata, there will probably be some processing through query, template or sth else. So if for that user seeing the tags is an eyesore, they will know the tools to hide them. Also conceptually this is simpler to me - the text is there, but sometimes it's special meaning

Counterargument:

optimize for people with a hacker mindset

😉

Terrance commented 2 months ago

(I should say I'm new to SilverBullet, so still discovering the layers of hackability... 🙂)

In general you may use a hashtag "in the flow" of some text, like you're doing now. In others you may use it to tag something more as meta data.

My understanding from https://silverbullet.md/Objects#Tags is that tags on their own are what actually tag the page, whereas ones mixed with non-tag text are just linking to it (and indeed the Pages vs. Paragraphs distinction seems to match this, with the latter more like the Linked Mentions section for page links).

I'm not sure what's involved in indexing, but I think in general I'd also expect the whole thing to be captured and shown when presented elsewhere, including any elements with special meanings.

I've also just spotted the table on https://silverbullet.md/Objects#paragraph where #paragraph-tag is similarly omitted from the table showing what I'm assuming is the raw indexed data about tags in paragraphs.

zefhemel commented 2 months ago

I like what @Maarrk is suggesting, which is to keep the tags in the indexed text, because there's means to remove it later for those who want it.

As to @Terrance your understanding of how it works. Indeed, tags by themselves on an empty line tag the whole page. If they're used in a (top level) paragraph, they'd tag that paragraph. If they're used in a task, or list item, they tag that task or list item. I think I've been inconsistent with in what cases I pull the tags out of the text and in what we don't, so would be good to standardize that. Probably keeping them in makes most sense.

zefhemel commented 6 days ago

Adding this to the 1.0 roadmap as we need consistent behavior across all object types. Either tags are removed or kept, or there is an attribute with the original text and one with the cleaned one.