I recently discovered several of the books I want to reformat are in CHM format (Compiled HTML). While doing some research online I found the following blog post which gave me the general idea and guidance on how to go about converting my CHM books to plain text:
Since some of the steps didn’t quite work on my MacBook Pro with macOS Sierra, I had to use different tools to accomplish the same result. These are the steps I followed to get my CHM in plain text:
1) brew install chmlib
2) extract_chmLib file.chm folder
3) cd folder
4) ls | sort -n > list
5) clean up/sanitize the list file so it only includes the files you want to convert.
6) for i in `cat list`; do textutil -stdout -convert txt $i >> out.txt ; done
Needless to say I did all the above steps from the command line.
Hope this helps someone else looking for an answer : )