Created
August 28, 2015 16:35
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "$1" | iconv -f utf-8 | pandoc -f markdown -t latex --no-wrap | iconv -t utf-8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Author
kmelve
commented
Aug 28, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment