A Markdown Webbrowser

Thanks to a Twitter follower, I got to thinking about this TUAW article highlighting Choosy for Mac.

This doesn’t directly solve my issues with sites like Macworld that play audio and video when they open. What I really want is a Markdown browser.

So, here’s a Markdown browser that uses the Mac app Fluid.

Create a new Fluid app. I’d suggest using the HeckYesMarkdown.com URL for the browser so you get a cool icon.

Next, let’s create a custom user script. Fluid user scripts match on strings in the URL and execute JavaScript. The documentation isn’t that great so this is my current best option.

Here’s the script:

:::javascript
passURL = document.URL;
if(document.URL.indexOf("heckyesmarkdown") <= 0)
    {
        document.location = 'http://heckyesmarkdown.com/go/?read=1&showframe=1&u='+passURL;
    }

This script is executed on any URL pattern based on the * trigger of the User Script.

We first grab the URL and hold it as a variable because we’re lazy and careful. Next, we look to see if the URL contains the string “heckyesmarkdown.” We then redirect all pages to http://heckyesmarkdown.com with a couple of nice parameters. The read parameter uses Readability. The showframe parameter makes the page look nice. Here’s an example.

That if statement exists so that we don’t just keep redirecting the heckyesmarkdown URL. We want to stop redirecting after the first URL is entered.

So now we can setup the Choosy preference to handle misbehaving sites. We should also add this Fuid app to Choosy as a new browser. Every link clicked in an email or Tweetbot (or anywhere outside of Safari) that matches a pattern will automatically be converted to a Markdown version in our new browser.

There are two major downsides. This Fluid app loads each page twice, so it’s a little like I’m rewarding bad behavior. On the other hand, I can tolerate browsing Macworld now. Second, the Markdown links are relative, so clicking them doesn’t actually load the next page.

Fluid for Mac | $5

Choosy for Mac | $12