read about this site and my work, or check the list of tags.

#technology #code #writing #language #diaries

moving Grammarly documents to markdown folder

I’ve used Grammarly for the last decade. I was happy how quickly they improved the grammar and punctuation checks. The synonym suggestion worked well for me. I paid the subscription, and was among the first users to try that awkward iOS keyboard. I wrote in my journal on November 13, 2017, that Grammarly for iOS is a little uncomfortable to use because it’s a keyboard.

When I depend on a product or stay at a pricey hotel room, I look around and start thinking how I can better design this thing. On April 23, 2020, I wrote down: “grammarly is where text starts, concept.” I would like to share my product insight with Alex Shevchenko. I never did — and the idea was self-explanatory — the text drafting folder app with a grammar and style check. I suppose I borrowed either the “feel-for it” or the “title” from Greg Pierce’s Drafts app

I quit Grammarly a year ago, even though they finally introduced text-library functionality right inside the App on the iOS device. It wasn’t convenient for me to “start texts” in the app, and, in fact, most times, I couldn’t finish them there either. The slowdowns, the logouts, the awkward UI and the general “corporate” vibe to the product — I felt that the company held some sort of “status quo” of the most-marketed app. Every time I looked for an alternative, I would get two hundred results of generic SEO texts with “expert” reviews of and comparisons to even less attractive competitors. All of them praised the product in question and supplied an affiliate link. Since then, I’ve been looking for an indie alternative that will work with the tools I already use.

Because I used Grammarly for a while, I had hundreds of notes get stuck in the app’s library when my credit card and I left. I’ve been doing some fixing and cleaning recently. I first thought of manually copying and pasting all of the texts I had in the library, but I found a better solution.

It appears that Grammarly communicates with the “Files App” on the iOS. I could “mount” the library like a Dropbox folder or an external drive and get to the content of the library in standalone documents. I was surprised to find out that those files were “.docx” files. The last time I touched something with “.doc” at the end was at the beginning of the century, so I felt a little ashamed that part of my workflow ever came to that. But at the same time, I was happy that I wouldn’t have to tap a stupid download icon a hundred times. After moving my files to the Mac, the next task was to purge my writing from the ghostly shells of the late MS Word. I remembered about Pandoc and was able to find a way to convert “.docx” files into plain-text markdown pretty quickly. Here are the steps in this process:

#!/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

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.