Skip to content

Instantly share code, notes, and snippets.

@kmelve
Created August 28, 2015 16:35
Show Gist options
  • Save kmelve/07edad89767cb161b93c to your computer and use it in GitHub Desktop.
Save kmelve/07edad89767cb161b93c to your computer and use it in GitHub Desktop.
This is a recipe for an automator service which takes marked text in markdown and converts it to markdown. In theory only the sh-script should be needed. Sublime Text, however, doesn't parse diacritics, umlauts and special characters. The key is therefore to normalize the output.
echo "$1" | iconv -f utf-8 | pandoc -f markdown -t latex --no-wrap | iconv -t utf-8
#!/usr/bin/env python
import sys
import codecs
import unicodedata
(utf8_encode, utf8_decode, utf8_reader, utf8_writer) = codecs.lookup('utf-8')
outfile = utf8_writer(sys.stdout)
infile=utf8_reader(sys.stdin)
outfile.write(unicodedata.normalize('NFC',infile.read()))
sys.exit(0)
@kmelve
Copy link
Author

kmelve commented Aug 28, 2015

screen shot 2015-08-28 at 18 35 36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment