hadynz / obsidian-kindle-plugin

Sync your Kindle notes and highlights directly into your Obsidian vault
MIT License
946 stars 52 forks source link

shortTitle and longTitle included as highlight template variables #181

Closed tjex closed 2 years ago

tjex commented 2 years ago

Context It's great to be able to point to highlights / notes in the Kindle clippings file within Obsidian with the # link syntax. eg ![[bookTitle#heading]]. This will then render the clipping in the Obsidian file I'm working in and be readable in line with the rest of the text on the page.

Is your feature request related to a problem? Please describe. However, as the book title is not available as a variable in the highlight template section, the resultant preview of the content shows only the location, but it is not clear from which book this originates.
Here is a picture exemplifying clippings being generated with this highlight template:

##### loc: {{ location }} ({{createdDate | date("DD-MM-YYYY")}})
> {{ text }} 
{% if note %}{{ note }}{% endif %}
---

By automatically making the location and date a heading, I can easily search through my clippings when link pointing in Obsidian and find the clipping I want. It will then show me everything under that heading:
Screen Shot 2022-08-05 at 18 06 33

Which then results in this render:
Screen Shot 2022-08-05 at 18 03 46

Therefore, if shortTitle and/or longTitle were variables, I could add them to the heading for clipping generation, and then when pointing to them in a separate file I would have the heading text telling me from which book the clipping is coming from. ie:

##### {{shortTitle}}, location {{location}}, {{createdDate}}
> {{text}}

Describe the solution you'd like Including {{shortTitle}} and {{longTitle}} and even {{author}} as variables in highlight template variables

Describe alternatives you've considered Manually writing the book title / author above the render in text.

mkrnr commented 2 years ago

I came here to wish for exactly this!

hadynz commented 2 years ago

My apologies for the late response on this thread.

Damn... in retrospect, that is such an obvious need and incredibly useful functionality. I'll implement this for you and as part of testing will also consider if your suggested template should be the default template for the plugin!

hadynz commented 2 years ago

I am testing your template. Having the title of the book achieves what you wanted - embedding a clipping that clearly tells you which book it is from.

However, when you are typing the link, the auto-complete dropdown doesn't give you any more context about which clipping you are referring to. You'd have to memorise the location id's 🤨. Any thoughts on a template that would make this more useful.

image

hadynz commented 2 years ago

I've added two new variables title and longTitle to the highlights template variables in 1.6.8.

Can you give it a try and let me know if it achieves what you wanted.

tjex commented 2 years ago

Yep, this works great. Tried title and long title. Both working as expected and desired 👌 Realised I should've suggested an {{ author }} variable too.. But I will try and implement this myself from October after deadlines and make a pull request. Thanks @hadynz !

tjex commented 2 years ago

Any thoughts on a template that would make this more useful.

I'm also not sure about this right now, but it's not so bad to have the kindle exports note open in another pane and to look through as normal, then just reference the correct location via block reference.

Perhaps Obsidian will implement a navigation pane within block references, where you could arrow down the list of results and then arrow right to reveal the content under that heading in a new / the same pane. Like a file navigation tree.

hadynz commented 2 years ago

@tjex the latest version of the plugin has now added an {{ author }} variable and more.