Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mkdocstrings_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
# Suppress griffe warnings
logging.getLogger("griffe").setLevel(logging.ERROR)

def replace_slashes(match):
# Get the content between $ signs
content = match.group(1)
# Replace double backslashes with single backslashes
fixed = content.replace("\\\\", "\\")
return f"${fixed}$"

class MkDocstringsParser:
def __init__(self):
Expand Down Expand Up @@ -136,6 +142,7 @@ def generate_documentation(self, module_path: str, options: Dict[str, Any]) -> s
markdown_docs = render_object_docs(obj, config) # type: ignore

markdown_docs = markdown_docs.replace(f"### `{to_replace}.", "### `")
markdown_docs = re.sub(r"\$([^$]+)\$", replace_slashes, markdown_docs)

return markdown_docs

Expand Down
Loading