Created
June 20, 2014 15:01
-
-
Save jkr/a8fbe639dd3b58537313 to your computer and use it in GitHub Desktop.
Convert smart markdown to dumb markdown
This file contains 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 python3 | |
import sys | |
if sys.version_info[0] != 3: | |
sys.exit("Must use python3") | |
replacements = {0x2013: '--', | |
0x2014: '---', | |
0x201c: '"', | |
0x201d: '"', | |
0x2018: "'", | |
0x2019: "'", | |
0x2026: '...', | |
0xa0: ' '} | |
text = sys.stdin.read() | |
for r in replacements: | |
text = text.replace(chr(r), replacements[r]) | |
print(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment