-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Use XBEL to store bookmarks #68
Comments
Hey, are you open to PRs? I'm curious to contribute to the Ctrl+F search functionality, and maybe also this issue. |
@lachrimae Definitely, happy to hear someone ask! I've been neglecting the search feature, so if you don't mind trying something difficult that's more pressing then this, then we can discuss it in #36. Otherwise feel free to contribute to any other issue I'm not working on already. |
If I may, I recently came across the XML Bookmark Exchange Language (XBEL) specification. It appears to be a fairly standardized way to manages bookmarks in a file (XML instead JSON). Also as a bonus point (not sure though) go should have a fairly good native package to handle xml, no extra dependency required. For documentation: |
I can't say that I'm that interested in supporting this format. I mainly just wanted a way to store the bookmarks that is not inefficient/hacky like the current solution. |
That's understandable but let me try prove its benefits. Also, I'm not a go programmer, so please forgive any misunderstanding. <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel>
<xbel version="1.0">
<folder folded="yes">
<title>Main</title>
<bookmark href="gemini://gemini.circumlunar.space/">
<title>Home Page</title>
</bookmark>
</folder>
</xbel> It's very straight (xbel->folder->bookmark). By default, it supports folders (should close #56 ). It supports an icon attribute which you can populate with the emoji favicon (so that it is shown in the bookmarks view. This page https://gobyexample.com/xml shows that it is possible and fairly simple to map 1:1 a Struct to an XML file using the And obviously, there is the advantage that since it is a third party standard, other apps like bombadillo could support it in the future, allowing for an easy exchange of bookmarks among people and clients. The whole point was that since you decided to move from toml to json, which is a structured but loosely typed language, moving to xml (structured and typed) should be almost the same amount of work, with way more advantages. A more complete example of file: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel>
<xbel version="1.0">
<folder folded="yes">
<title>Main</title>
<bookmark href="gemini://gemini.circumlunar.space/">
<title>Home Page</title>
</bookmark>
<bookmark href="gemini://gemini.circumlunar.space/">
<title>Home Page Again</title>
</bookmark>
</folder>
<folder folded="yes">
<title>Second</title>
<bookmark href="gemini://gemini.circumlunar.space/docs/">
<title>Docs</title>
</bookmark>
</folder>
</xbel> |
Thank you, this is helpful. I may end up implementing this then, seems useful. I will indicate when I have started work on this, so if anyone wants to create a PR that does this before that point, feel free. |
Why not exploit the filesystem and Gemtext for this? This way no new rendering capability is needed and it is easy for users to edit/generate their bookmarks outside amfora. Keeping bookmarks as simple, plain-text files is a good thing IMO. If we restrict bookmark folder depth to 1, we could have something like:
where the contents of
|
@sotpapathe It's an interesting idea. I like the bookmarks being more structured, because they tend to be structured data, but I guess there's no reason why it can't just be a text file. It just feels a bit too loose to me, but I can't say I have a very good reason not to do it. |
@makeworld-the-better-one Maybe we can come up with an idea to have both structured and user-editable bookmarks. Another idea is:
where each |
This is only my opinion, but I'm fairly against this concept. Let me try build my case.
As a general rule of thumb it is a bad idea to leverage the filesystem to structure data. It should act instead as a final destination for already processed data for long term storage. I can think of performances (number of IO), consistency, atomicity of operations and the like as generally hard things to tame even at small scale. Personally, even though they are distinct, I consider the amfora bookmarks as And I also can think of the hardships of debugging an eventual malformed bookmark in the middle of hierarchy of files and folders.
I disagree. Even an xml file is simple, plain-text (as in non-binary). Taking your example of text:
It has a structure. Now add a favicon, a title, and the date of creation (separated by
IMO there is little point in reinventing the wheel, given how many products rely on bookmarking functionality. XBEL (or the original JSON file option) seems preferable. PS. |
@sotpapathe I agree with everything @Jackymancs4 said, they explained it better than I could. I don't have a strong preference for XBEL over JSON, but I definitely prefer either over just storing files without a format. |
Agreed, these are all valid reasons to avoid multiple bookmark files. I am not
I do the same, but I generate the bookmark files for my various browsers from I don't have such a strong opinion on this, I can live with XML if it's
Thanks @Jackymancs4! |
This was my issue as well with how I did it originally, and why I want something new. XML isn't my favourite either, but I like that the XBEL format already exists and is clearly extensible and designed for bookmarks, as opposed to any bespoke JSON format I could come up with. The current format is a base32 encoding of the URL, btw. I feel pretty decided on this subject. Unless someone finds a format much better and more widely used than XBEL I'd like to stick with it. |
I think it is a philosophical issue whether or not to invite an XML based language to a Gemeni software. |
While some may have qualms about XML's relative complexity, I don't think it's that big a deal. And this part of Amfora has nothing to do with Gemini, and all the simplicity guarantees it has. As I said above:
|
I think we could easily accomplish what @sotpapathe was talking about using gem markup, without falling into pitfalls of using multiple folders by simply using headers.
Right now it's very difficult to get bookmarks out of amfora, which is frustrating because it makes it very hard to share them between other clients. somehow my bookmarks are invalid base32 according to my command line? At the very least storing them as .gmi would be a cool way to be able to have a single file you could at least access in other clients. |
Using gemtext is a completely unstructured and flexible format, and so I'm not really interested in storing structured data like bookmarks inside it. Converting the XBEL file to a nice-looking gemtext file would be an easy task though, and I'd be happy to include that kind of capability in Amfora, or maybe as an external script. So you could just run |
Spec reference: http://xbel.sourceforge.net/language/versions/1.0/xbel-1.0.xhtml |
At long last this is implemented! Thanks for everyone's suggestions. The master branch version of Amfora will now move your existing bookmarks into an XML file and delete the old one. This makes for easy editing and managing. |
Re-opened until the master branch properly supports multiple bookmarks with the same name. Also check support for bookmarks with different names but the same URL. |
Fixed in 9fd5deb. Bookmarks with the same URL are not supported as that doesn't make sense. |
(Original title was: Use JSON to store bookmarks. It was changed after discussion below.)
TOML is not appropriate for this purpose. Viper still might be. There will have to be migration code to detect the existence of the old .toml file and convert it.
The text was updated successfully, but these errors were encountered: