Closed chrisgrieser closed 2 years ago
@chrisgrieser can you share the configuration of your tag note. Something like
---
BC-tag-note: ' #tag'
BC-tag-note-field: down
---
I've changed the behaviour of tag notes. This is the new logic:
BC-tag-note-field
<blank>
as their default, use the first field of all the fields
here is a screenshot. I have a total of 28 notes with the tag #wissenschaftssoziologie
, only one of them shows up in breadcrumbs.
looking at the note, I think I found the issue. It's the only note that has #tag
in its body, the others have tags in the yaml header.
I tested it adding a tag to the yaml header and then breadcrumbs indeed picks it up. So it's an issue of breadcrumbs not recognizing tags in the yaml anymore
Ahhh interesting, ok. I'll have to check what's going wrong there
Similar issue but it's not picking up on tags in general, regardless of where they are.
Reproduced the bug with a simple case.
Create folder and add an empty note.
Here's a GIF:
Thank you everyone for the feedback. I'm trying to resolve this issue, but also struggling to reproduce it... Can you try out the latest release and see if tag notes work again
nope, still the same here, only inline-text tags working for me
@chrisgrieser how about now in the latest release?
Wait, I see the error now. Give me a sec
@chrisgrieser the issue is that Obsidian doesn't recognise tags: b, d
as actual tags. So I have to treat those differently. Not an issue, but that's why it wasn't detecting them after the change
Ok, for realsies. This issue should be fixed now
yep, works now :)
(Thanks for the fix! I'll leave it open as @lkadre reported an issue which could be different)
Unfortunately it's still not working for me. I'm attaching the Console log, it seems to have some BC errors related to .addTagNotesTo Graph and .getAllTags.
@lkadre do you have any idea which notes are causing the errors? From your console logs (thanks!) I suspect the issue is a rogue tag, or a syntax Breadcrumbs isn't expecting. If you can send some examples of how you store your tags (in frontmatter), that'd be really helpful :)
Pretty much all of the tag notes seem to not be working. All the other hierarchies are fine (hierarchy note, inline and frontmatter fields).
I actually store the tags in the body of the note (lists/pseudoadmonitions). I've made some tests moving them around; no luck so far, but perhaps the issue is that they're wrapped in a different CSS class?
I do have one or two tags that I store in the frontmatter as seen below. They're not used by Breadcrumbs in any hierarchies. Another possibility I can think of is that they're subtags.
Here are some example of Tag Notes:
---
creationdate: Wednesday 22nd September 2021
creationdatetime: 17:41
zettelkasten: 202109221741
cssclass: admonitions
BC-tag-note: '#law/contract'
aliases:
tags:
- 060-concepts
---
- [i] #law/contract
---
creationdate: Saturday 27th November 2021
creationdatetime: 04:04
zettelkasten: 202111270404
BC-tag-note: '#m/postmodernism'
cssclass: admonitions
aliases:
tags:
- 060-concepts
---
- [i] #m/postmodernism
And notes that I would expect to show as a "child", which show up on tag search but not on the matrix/list:
---
creationdate: Friday 3rd September 2021
creationdatetime: 18:01
zettelkasten: 202109031801
cssclass: admonitions
aliases: [United Nations Convention on Contracts for the International Sale of Goods, Vienna Convention]
tags:
- 060-concepts
---
- [i] #t/treaty #law/contract
---
creationdate: Saturday 27th November 2021
creationdatetime: 04:01
zettelkasten: 202111270401
cssclass: admonitions
aliases:
tags:
- 040-people
---
- [i] fullname:: Paul-Michel Foucault
- [i] birthyear:: 1926
- [i] deathyear:: 1984
- [i] nationality:: #civ/FR
- [I] #m/postmodernism
@lkadre can you please post this in the console, and hit enter while focussed on a note with lots of tags in it. Check to see that all the tags are in the result, and that they all start with #
.
let getAllTags = (file, withHash = true) => {
const { tags, frontmatter } = app.metadataCache.getFileCache(file);
const allTags = [];
tags?.forEach((t) => allTags.push(dropHash(t.tag)));
[frontmatter?.tags ?? []].flat().forEach((t) => {
splitAndTrim(t).forEach((innerT) => allTags.push(dropHash(innerT)));
});
[frontmatter?.tag ?? []].flat().forEach((t) => {
splitAndTrim(t).forEach((innerT) => allTags.push(dropHash(innerT)));
});
return allTags.map((t) => (withHash ? "#" : "") + t.toLowerCase());
};
let dropHash = (tag) =>
tag.startsWith("#") ? tag.slice(1) : tag;
let splitAndTrim = (fields) => {
if (fields === "") return [];
else return fields.split(",").map((str) => str.trim());
};
getAllTags(app.workspace.getActiveFile())
Tested on the first "child note" above. It does show all tags, but then has an error.
@lkadre I don't think that error comes from Breadcrumbs... I don't recognise any of the things in it. But that's even weirder, it finds all the tags correctly, and there aren't any errors. I'll have to keep testing
@lkadre I'm trying every test case I can possibly think of, and they all work...
I turned off every other plugin (including Dataview) and reset to the default theme to see what happened. Still the same error...
Obsidian Developer Console
VM109:52737 loading breadcrumbs plugin
2VM109:53847 TypeError: Cannot read property 'split' of null
at splitAndTrim (eval at <anonymous> (app.js:1), <anonymous>:22481:23)
at eval (eval at <anonymous> (app.js:1), <anonymous>:52673:17)
at Array.forEach (<anonymous>)
at BCPlugin.getAllTags (eval at <anonymous> (app.js:1), <anonymous>:52672:140)
at hasThisTag (eval at <anonymous> (app.js:1), <anonymous>:53521:38)
at eval (eval at <anonymous> (app.js:1), <anonymous>:53528:69)
at Array.filter (<anonymous>)
at eval (eval at <anonymous> (app.js:1), <anonymous>:53528:18)
at Array.forEach (<anonymous>)
at BCPlugin.addTagNotesToGraph (eval at <anonymous> (app.js:1), <anonymous>:53514:22)
initGraphs @ VM109:53847
@lkadre Ahhh sorry! I see now you posted the log file. The error in the screenshot isn't BC-related, but this one definitely is. Ok, I've added a patch in the latest release. I don't know why thee error you posted happens, but the patch should bypass it
IT WORKS NOW!!! that was some detective work, thank you so much for your patience!
Ahh that's great to hear 😄
Phew, that was a sneaky bug, indeed.
The underlying issue is not actually resolved. I believe the cause it that one of your notes has a blank tags field tag:
or tags:
. That would probably cause the problem you faced here. But the patch does overcome that, so all is well
Alright, I'm gonna close this issue then 😋
since the latest update (v.2.20), tag-notes have stopped working completely. Link-Notes, Folder-notes and everything else still shows up, but tag-notes do not show up anymore.