swh:1:snp:02443124ed4ee0d8d724fefd38bf9b271361cc09
Tip revision: 800919da4d6c104401e877a14e4bd7778e750ab4 authored by Jan-Michael Rye on 25 July 2023, 13:32:51 UTC
Initial commit
Initial commit
Tip revision: 800919d
markdown.py
#!/usr/bin/env python3
'''
Functions for generating Markdown files.
'''
_SPECIAL_CHARS = r'\`*_{}[]<>()+-.!|'
_TRANS_TABLE = str.maketrans({char: f'\\{char}' for char in _SPECIAL_CHARS})
def escape(text):
'''
Escape special symbols in Markdown text.
'''
return text.translate(_TRANS_TABLE)