# This program is public domain # Author: Paul Kienzle r""" Allow $math$ markup in text and docstrings, ignoring \$. The $math$ markup should be separated from the surrounding text by spaces. To embed markup within a word, place backslash-space before and after. For convenience, the final $ can be followed by punctuation (period, comma or semicolon). """ import re _dollar = re.compile(r"(?:^|(?<=\s|[-(]))[$]([^\n]*?)(?