swh:1:snp:02443124ed4ee0d8d724fefd38bf9b271361cc09
Tip revision: 2c5eb46670ff967c71d35397568ab60eed423151 authored by Jan-Michael Rye on 02 October 2023, 15:07:23 UTC
Handle exceptions when converting InChIs to molecules
Handle exceptions when converting InChIs to molecules
Tip revision: 2c5eb46
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)