Markdown file to Twitter thread using Alfred and Typefully
Sometimes we want to quickly split content into chunks to share on Twitter. I'm going to show you how we can paritally automate this flow using Alfred, a bit of scripting and Typefully.
This automation uses Alfred to consume a markdown file and split it into Twitter sized chunks on your clipboard. You can then use this to insert into Typefully or your favourite Twitter thread creator.
Step 1. Use Alfred to trigger the process
Create an Alfred workflow that takes in a markdown file and runs a script on it. The script should output the tweets to the clipboard. You can see my Alfred workflow and the script on GitHub here.
The script should not only split the text into tweet sized chunks but also sanitise the data. My script is very simple it splits into tweet sized chunks and removes markdown image syntax but leaves the image link.
If you wanted to improve on this you could look into using Abstract Syntax Trees or even something like GPT-3.
Step 2. Add the human touch
Paste into a text editor to view the tweets. I have mine separated by two new lines as the Typefully app uses this to denote a new tweet. You will want to modify and make it more suitable for the Twitter audience.
Step 3. Paste into your thread maker
I currently use Typefully for my threads. It separates tweet by 2 carriage returns - but this split is triggered when you type the Threads in rather than simply pasting. I use a simple Keyboard Maestro command that types in my clipboard for me.
The script I'm using here is fairly simple but can be improved and iterated upon.