Skip to content

Instantly share code, notes, and snippets.

@ckunte
Last active December 6, 2019 02:02
Show Gist options
  • Save ckunte/a4047c85fefb503c1461 to your computer and use it in GitHub Desktop.
Save ckunte/a4047c85fefb503c1461 to your computer and use it in GitHub Desktop.
Convert all Markdown files in a folder to plain text version. (It strips all html and markdown markups in text.)
#!/usr/bin/env zsh
# 2014 ckunte
# Convert Markdown files in a folder to plain text
# Requires pandoc and zsh.
#
# Run the following at zsh prompt:
#
# $ zsh md2txt.sh
#
for file in *.md; do pandoc -f markdown -t plain --wrap=none "$file" -o "$file.txt"; done
autoload zmv
zmv '(*).md.txt' '$1.txt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment