moving Grammarly documents to markdown folder
I’ve used Grammarly for the last decade. I was pleased with how quickly they improved their grammar and punctuation checks. The synonym suggestions worked well for me. I paid for the subscription and was among the first users to try their awkward iOS keyboard. On November 13, 2017, I wrote in my journal that Grammarly for iOS was a bit uncomfortable to use because it’s a keyboard.
Whenever I depend on a product or stay at a pricey hotel, I start thinking about how I could redesign it. On April 23, 2020, I wrote: “Grammarly is where text starts, concept.” I wanted to share my product insight with Alex Shevchenko, but I never did. The idea was self-explanatory—a text drafting app with built-in grammar and style checks. I think I borrowed either the “feel” or the “title” from Greg Pierce’s Drafts app.
I quit Grammarly a year ago, even though they finally introduced text-library functionality directly in the app for iOS. It wasn’t convenient for me to “start texts” in the app, and most of the time, I couldn’t finish them there either. The slowdowns, logouts, awkward UI, and the overall “corporate” vibe made the product feel stagnant. Every time I searched for an alternative, I found hundreds of generic SEO articles with “expert” reviews comparing it to even less appealing competitors. All of them praised Grammarly and included an affiliate link. Since then, I’ve been looking for an indie alternative that works with the tools I already use.
Because I used Grammarly for so long, I had hundreds of notes stuck in the app’s library after my credit card and I parted ways. While doing some recent fixing and cleaning, I first considered manually copying and pasting all my texts. Then, I found a better solution.
It turns out Grammarly communicates with the “Files App” on iOS. I could “mount” the library like a Dropbox folder or an external drive and access the contents in standalone documents. I was surprised to find out the files were “.docx.” The last time I touched a “.doc” file was at the start of the century, so I felt a bit ashamed that my workflow had come to this. But at the same time, I was relieved that I wouldn’t have to tap a download icon a hundred times. After moving my files to the Mac, my next task was to purge my writing from the ghostly shells of MS Word. I remembered Pandoc and quickly found a way to convert “.docx” files into plain-text markdown. Here are the steps in this process:
install brew and pandoc
create a “script.sh”:
#!/bin/bash
cwd=$(pwd)
# find all .docx files
find $cwd -name "*.docx" -type f -print0 | while IFS= read -r -d $'\0' line; do
# remove spaces in filename
ns_filename=$(echo $line | sed 's/ /_/g')
# get filename from input
the_filename=$(basename -s .docx $ns_filename)
# convert word to markdown
# echo "pandoc -f docx -t markdown \"$line\" -o $the_filename.md"
pandoc -f docx -t markdown "$line" -o $the_filename.md
done
- run
chmod u+x script.sh
- run
bash script.sh
- Given that I will ever need the script again, I would like to know how to “strip feeds,” i.e. remove the line breaks inside the paragraphs.