Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: export another json with breadcrumbs metadata? #13

Open
chrisgrieser opened this issue Feb 12, 2022 · 10 comments
Open
Labels
enhancement New feature or request

Comments

@chrisgrieser
Copy link
Contributor

long term only, but using the Breadcrumbs API, one could also export data on the breadcrumbs index to navigate it via Alfred 👀

https://discord.com/channels/686053708261228577/855181471643861002/942003316123119646

@kometenstaub
Copy link
Owner

https://skepticmystic.github.io/breadcrumbs/interfaces/BCAPII.html#getMatrixNeighbours

That would probably make the most sense? So iterating over all markdown notes to get their hierarchies.
The real question for this would be performance.

@SkepticMystic
Copy link

@kometenstaub I could certainly expose something (or even code something new) to make this more convenient.
Let me know what sort of info you need (and the type signature), and I can see what would be easiest/fastest

@SkepticMystic
Copy link

SkepticMystic commented Feb 12, 2022

But yes, getMatrixNeighbours would certainly work to get all Breadcrumbs links.
I'm thinking it might just be easier to work with the graph though

@kometenstaub
Copy link
Owner

kometenstaub commented Feb 12, 2022

I see. Ideally I could just give it a TFile and get the directions back.
But that would probably be quite taxing on performance.

Looking at app.plugins.plugins.breadcrumbs.api.mainG, I could access _nodes and move that into a web worker, but then I would need to do all the work breadcrumbs does for calculating the relationships. That's not something I'm planning to do.

I also cannot find the paths and only the note names in it, so that would also not work properly for duplicate names, I think.

@SkepticMystic
Copy link

I think getMatrixNeighbours gives all the info you're looking for.
And I think it does the calculation relatively efficiently.

But yes, duplicate note names are an issue

@kometenstaub
Copy link
Owner

const files = app.vault.getMarkdownFiles()
const api = app.plugins.plugins.breadcrumbs.api
let arr = []
for (const file of files) { arr.push({[file.path]: api.getMatrixNeighbours(file.path.split('/').last().slice(0,-3))})}
console.log(arr)

This does the trick, I'm impressed that graphology's forEachEdge is so fast.

Do you have plans to add support for TFiles to better work with duplicate file names?

@kometenstaub
Copy link
Owner

But it doesn't get the dataview inline metadata with that. @SkepticMystic

@SkepticMystic
Copy link

The issue is that the nodes are added to the graph using just the basename, not full path. So I'd need to completely redo how that's done.
But then there are other issues that come up. It's quite a difficult problem.

@SkepticMystic
Copy link

But it doesn't get the dataview inline metadata with that. @SkepticMystic

@kometenstaub what do you mean? It doesn't pickup inline Breadcrumbs parent:: [[Note]], or it doesn't add other dataview fields date: 2022-02-13

@kometenstaub
Copy link
Owner

The issue is that the nodes are added to the graph using just the basename, not full path. So I'd need to completely redo how that's done.
But then there are other issues that come up. It's quite a difficult problem.

I suppose that is because it doesn't work with links alone but just frontmatter? So you couldn't just run getFirstLinkPathDest on it?

It doesn't pickup inline Breadcrumbs parent:: [[Note]]

That was it. It does work when I manually refresh the index though.

So before executing it, I would need to do

app.commands.executeCommandById('breadcrumbs:Refresh-Breadcrumbs-Index')

But that also displays a Notice, which isn't great for something that would usually run on a schedule.

@kometenstaub kometenstaub added the enhancement New feature or request label Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants