Hacker News new | ask | show | jobs
Show HN: Glass Dome — an Alfred workflow to fight link rot in markdown notes (github.com)
82 points by macedotavares 2259 days ago
6 comments

Hey!

Following the advice dang left in the comments, here’s the backstory for this workflow:

I've been taking plain text notes on my computer for almost 20 years. I’ve been keeping bookmarks for longer than that.

A few months ago, I subscribed to Pinboard and imported all these 1000+ bookmarks, only to find that hundreds of them were dead links. I could remember many of those websites and pages, I could recall how and why they were important to me; I just couldn’t see them. And never will again. It was depressing and alarming.

So, weeks later, when I stumbled upon Jeff Huang’s manifesto “Designed to Last”, it deeply resonated with me. I was setting up a blog, then, and even considering a new note-taking setup, and future-proofing became an even greater concern for me.

Like I said, I keep plain text notes. I use markdown a lot, and feel comfortable migrating my notes between different apps and platforms. For example, I’m currently moving from Bear to Roam.

The text itself is never a problem — and probably will never be — but linked content is a whole different beast.

Each time I switch apps, I either lose inline images or have to relink them, sometimes manually. And URLs often go bad, so the note is suddenly worth a lot less, if anything at all.

Being an enthusiastic Alfred user (it's the single most important app on my macs), I started to play around with the idea of copying every image to a single "resources" folder in my Dropbox, before using it inside my notes.

With a single keyword or keyboard shortcut, Alfred would take care of uploading an image via DB's API, get the share link for it and then put it in the clipboard, properly formatted with markdown. The same principle applied to any file attachment.

Half of the problem was solved. But what about web pages?

I considered using wget to scrape the page at any given URL, store it on Dropbox and do the same routine. I still entertain the idea. But then there's the Internet Archive's Wayback Machine. And I love it so so much, that I wanted to contribute. So I went with it instead: Alfred takes the URL, feeds it to WBM through curl, and then returns a link to its time stamped snapshot. Actually, it returns both the live and the snapshot links, the latter with a cool hourglass emoji as anchor.

So, now I don't fear losing track of linked files or worry too much about websites going down. Once I had these two bases covered, I thought to myself "this is pretty powerful. I should share it." And so I did.

I hope more people find it useful, and would appreciate any comments, ideas or suggestions.

Cheers!

This is pretty cool!

I might be able to learn from your outer loop, actually--this is close to a much simpler problem I've needed to solve.

I take my notes in markdown bulleted lists, and try to make them very narrow so they fit on the side of my monitor. I shorten all my links to keep the character count down. The shortener we use at work times out the links if they're not used, though, so in old notes I can go back and discover my alias is gone.

I've been meaning to write something that just sweeps my notes and hits the links through the shortener URL periodically as a keepalive. Since the notes are not always conveniently in one tree with nothing else around, I was thinking something a little richer than text extraction piped to curl.

If nothing else, maybe this'll inspire me to get off my ass and actually get it done.

Thanks!

If the URL shortener has an API, maybe you could write a script that keeps a record of every URL passing through it, and then run curl on those records with a cronjob or something.

I’m guessing you use a plain text editor for your notes and want to stick with it, but some note-taking apps, like Bear and Roam automatically hide the URLs in markdown links, so you could keep them as short as their titles. This would bypass the need for a URL shortener.

Definitely, if I were using rendered output primarily that'd make a ton of sense of course.

As you surmised, though, I use VS Code, vim, nvAlt, and iOS text editors as my primary tools (depending on setting) and actually create/read the journal in pure plaintext.

The markdown formatting is more so I can c/p rendered versions from a preview HTML page to Google Docs and other targets that understand rich text from clipboard but not markdown directly--I can create meeting minutes and whatnot from my notes very quickly that way.

I would move away from url shorteners.

- It’s a single point of failure.

- If the database breaks, you loose all your links.

- If they get attacked, they can redirect to malware.

- If they go out of business or gets shut down, you have another issue to solve.

If you’re using markdown, asciidoc, restructuredtext you can create a link and hide the url with text.

Equivalent to,

    <a href=“http://example.com/some/page/here”>Example</a>
You can't hide it in plaintext, which is the point.

I think your post got partially eaten by HN as formatting but I understand the []() format for MD--but you can see where that's at least 2 chars longer than just putting in the raw URL, and not super necessary in my editor that auto-linkifies. The markdown formatting is so I can share it with other people and paste into gdocs, but 50 char wide plaintext is the primary format.

It's also an internal shortener service within an established company that maintains it well, but I appreciate your points for public ones.

It's been my experience when going through old notes files that "dead" links are not always dead; sometimes they've just "changed their name". Sometimes a search on the title will find the website of interest at a new location. Sometimes the website can be found in the Internet Archive.
True! Actually, I was able to recover some of my lost bookmarks using the Internet Archive. That made me love it even more, eventually leading to my choice of the Wayback Machine.
Another alternative to Internet archive is perma.cc. A webmaster can write to IA and request that they pull archives off their site at any moment: https://perma.cc/
I didn’t think of that. Thanks for suggesting an alternative. I’ll check it out.
Looks good! However, I don't want to use dropbox... any plans for supporting other data sources?
Thanks, voz!

As long as that other platform has some API that supports link sharing, it shouldn’t be too difficult. What would you like to use?

For what it's worth I would also love a version that saved to local text file/relative filename.

In an ideal world, this would integrate with Hook links too -- I want that bad enough that I'm considering trying to figure out how to do it on my own.

BUT -- you may want to take a look at (Hook: https://hookproductivity.com) yourself -- it seems like exactly the kind of thing you know how to put to excellent use.

Funny you should mention Hook. When I first heard about it, I made another Alfred workflow (called Rabbit Holes) that allowed me to gather related files, notes and bookmarks under a particular subject.

It relied on unique id numbers for each subject and an index file that listed them. For instance, if I wanted to associate a pdf to the subject "Hypertext", I would:

1. Select the pdf in Finder

2. Run the workflow and perform a fuzzy search on the index file

3. Find the subject and select it.

Then, the pdf's filename would be prefixed with the code corresponding to "Hypertext"; finally, a master note for "Hypertext" would be appended with the link to that file.

(This workflow also used Dropbox though. It would have been easier if it didn't.)

If you use Alfred (with Powerpack), I'm sure we can think of something that may at least look like an alternative to Hook.

I'd like to just store the saved version in the same directory as my note, and use a relative link to the filename.
http://fuckyeahmarkdown.com by nvAlt's Brett Terpstra is very cool. It provides an API that you can use to convert almost any webpage to markdown. Then, it's only a matter of linking to that file. Again, Alfred can do this pretty easily.
It appears you are the creator of this? You might want to consider reposting as a Show HN as they are typically received differently by the community.
Indeed I am. I've just created my HN account in order to post this. I'll do as you suggest. Thank you for the heads-up. Cheers!
Welcome!
Thanks, smoyer. See you around!
One tip: add a comment to the thread giving the backstory of how you came to work on this, and explaining what's different about it. That tends to seed discussion in a good direction. Good luck!

Other tips here, though it looks like you've got them covered. https://news.ycombinator.com/item?id=22336638

Thanks for the advice, dang. I’ve just posted the backstory. A bit long, though. I hope it’s not overkill.