swh:1:snp:02443124ed4ee0d8d724fefd38bf9b271361cc09
Tip revision: 05eb097fe8fe8037e899f45bb1cca8a681dcc0df authored by Jan-Michael Rye on 30 September 2023, 00:53:03 UTC
Support custom InChi-to-Mol functions
Support custom InChi-to-Mol functions
Tip revision: 05eb097
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)