-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Customizable template for Slurp notes #3
Comments
Good news, author is already supported! It will appear when it can be found during parsing. It currently leaves out properties it doesn't get a value for though. Would you want to be able to set those properties when you're loading a URL or after the page is saved? I haven't tried MarkDownload, sounds like I should check it out and look for friction. |
Ah, I see. I would pretty much prefer it to always add the property, so that I can manually add them when they cannot be parsed.
I think just saving everything in a file would be the most straightforward solution, since adding values to properties works fine in a regular Obsidian note already |
I've added this as a settings toggle in v0.1.3. it won't affect existing notes though! |
Thanks for the quick implementation! However, I do not think this issue should be closed (yet), since it has been only partially adressed – it is not possible to assign custom keys or define which properties to be included in what order etc. |
ah i see! yeah that goes a bit deeper than what i understood from your initial comment. i'll be honest, i'm a bit wary of going deep on customization in these early versions. automatically populating properties is high on my priority list, but adding new properties after people have been using slurp for a while could introduce a fair bit of friction. key conflicts in particular worry me. maybe it makes sense to establish a relatively comprehensive set of "reserved" keys and data types first, then offer customization options later. right now i've been looking at adding fields to handle multiple authors, reference IDs (eg: |
yeah that makes sense. i was looking at replacing the hardcoded format with a template at some point anyway. i see that markdownload extracts all |
Kinda. It does include some information, but as I mentioned, MarkDownload does not include the publication date or the site name, for instance (though it does include the host, which is mostly similar). It also lacks a few quality-of-life features such as removing the "by" in the author-byline, e.g. |
seems odd because according to their GitHub, they use the same library as slurp under the hood. I'll look a little more deeply into their codebase and see if they're doing things that I should avoid. do you have a couple links to pages where that's happened? would be good for testing |
the publication year is missing everywhere, it's simply not available in MarkDownload as a token. Author is missing a lot of places, a simple example could be this article |
thanks for the link! that's a great one to know about. what's interesting is that slurp didn't get the author out of that either, even though there is a meta tag for author. i'm going to open a few issues for supported properties that don't get picked up when they should. if you could throw more links like that verge one into those it would be a huge help. |
decided against the raw template since i can't rule out breaking changes to the available properties in the near future. plus, this way it'll be easier to find out about new properties. Recording.2024-04-11.125004.mp4 |
looks awesome, makes for a much better UI as well! A small suggestion: could you add the possibility to add custom properties as well? One use case is to add a property field |
yep, that's on the agenda! wanted to nail the existing properties down first. i've pushed up the initial version of this for testing. i had to abandon the fancy drag and drop functionality as it wouldn't play nice with the rest of the components, but the functionality is all there. it would be awesome if you could help test it out by setting up BRAT. Edit: Forgot to mention that the ordering won't work yet. it will save the ordering you configure but won't actually write new notes with that ordering. |
Would love to, you haven't created a new beta release for BRAT, so it still installs 0.1.4 |
oops, sorry about that. should be fixed now |
0.1.5b1 throws an error:
|
ok so i had to shave a lot of yaks along the way but it should be working now. i made a lot of changes to the settings file format, so you might run into an issue there. a quick sanity check would be to check for
|
Thanks, b2 seems to work now. With the default settings, the article gets downloaded correctly. However, with some custom settings, the metadata creation seems to fail:
---
undefined
--- some other issues I noticed:
|
hmm yes it seems my validation function is a bit overzealous. i'll rework it. the blocked characters are only meant to trigger a validation error only if they're at the start or end of the string.
i've implemented the necessary functions for formatting but it hasn't been added as an option yet. i'm still working out how to best to expose that through the settings UI. so while i haven't tested the formatter thoroughly yet, you can try it out by modifying the data.json file directly for now: "publishedTime": {
"id": "publishedTime",
"key": "year",
"idx": 2,
"format": "d|YYYY-MM-DDTHH:mm",
"enabled": true
},
"modifiedTime": {
"id": "modifiedTime",
"key": "updated",
"idx": 3,
"format": "d|YYYY-MM-DDTHH:mm",
"enabled": false
}, the worth noting too that all string properties can be formatted using the same syntax as well. it's already being used for tags. the format string just needs to start with
the page title is the parsed title anyway, so i didn't see much of a point to duplicating it in the note properties. is there a use-case you have in mind for that?
that is indeed the case :) most of the time i put in this weekend was to ensure that the core properties and custom properties would play nicely together. there's still more work to do on that front. in particular i need to ensure that settings will be gracefully migrated between plugin updates. right now slurp will just try to slam whatever is there together with the core options without checking for incompatibilities first. this will likely get done before i do the custom date format options.
anyone who doesn't like it can deal 😉 it's a pretty minor thing and shouldn't interfere with anything else. i found that, without an animation of some kind, i sometimes didn't notice that the items changed order so i'd click the button again only to accidentally flip the ordering back. the animation does seem to be pretty inefficient compute-wise though, so i might simplify it in the future. |
also, regarding the i'll try to reproduce on my end as well later tonight, but it would be good to have your logs too for comparison. edit: i couldn't help myself and ended up reproducing it just now. looks like when there are no tags, slurp doesn't get rid of the set object it uses to store them and thanks again for your help testing this by the way! i promise i'll add some automated tests soon so the easy stuff won't have to be caught by users like you 😄 |
hah ok so don't worry about reproducing it! i fixed the issue. it was actually two issues, one was the empty set breaking the YAML parser, and the other was disabled properties were forcing an early exit from the metadata parsing function entirely. in testing the fix i also noticed a third issue: disabled properties were re-enabling themselves. i've pushed those fixes up. a new v0.1.5b3 release will be available shortly. |
Can confirm, b3 fixes the
There are multiple reasons for a
|
alright so i went through and added all of those. in classic form, i broke some of it while working on state management at the same time. 🙃 enabling/disabling and deletion seem to be affected. adding new fields, adjusting formats, and changing keys should all still be working though. overhauled the UI to be more obsidian-like as well. new beta should find its way to your machine shortly. |
BRAT complains, since there is only a tagged commit for b4, but no pre-release yet |
just added it. obsidian's build workflow was complaining and it was too late at night to troubleshoot it |
I have a fix for the issue with Enabled already, should be able to push it up along with a couple other changes later today. The data type thing is annoying. I switched to using a yaml parser as part of this and I'm not really a fan of how it wraps everything in quotes like that. YAML doesn't require that and it makes handling things like boolean values particularly tedious. It does offer a lot of options at least, so I'm hoping I'll be able to configure away that behaviour. |
alright, things looking better now. keep your eyes peeled for a new release. |
Okay, checked out b6, custom properties &
|
ok! those should be fixed in 0.1.5b7. thanks for all your help on this! |
Thank you! At long last, it seems everything works now – cannot find any issues anymore 🥳 Will migrate my setup to Slurp now. Maybe there will be some minor leftover issues I'll find in daily use, but I guess that would be a new GitHub issue. |
Thanks for this plugin. Looking forward to replace Advanced URI + MarkDownload with it.
One of the main features missing would be to customize the properties (frontmatter) of the slurped files. Adding the date and the site name is good (already an improvement to MarkDownload!) but some things author, other names, manually added properties would be really useful
The text was updated successfully, but these errors were encountered: