ml-tooling / lazydocs

📖 Generate markdown API documentation from Google-style Python docstring. The lazy alternative to Sphinx.
MIT License
205 stars 38 forks source link

Backslashes in LaTeX failing with GitHub Markdown #76

Closed dannaf closed 1 month ago

dannaf commented 4 months ago

Describe the bug:

LaTeX code with backslashes in a Markdown docstring in Python does not render properly in GitHub.

Expected behaviour:

The README highlights lazydocs as compatible with Github Markdown, so the expected behaviour is that a Markdown documentation page generated from a Python docstring using lazydocs will render properly in GitHub, including all Markdown features that are supported on GitHub, including LaTeX. However, natural LaTeX code (with a natural/single number of backslashes) does not work reliably in the lazydoc output when viewed on GitHub.

Steps to reproduce the issue:

  1. Create a blank python file with just the following docstring:
"""The vector $\mathbf{x}$ when written with a single backslash and works, but specifying a $3 \times 3$ matrix with a single backslash fails.

Specifying a $3 \\times 3$ matrix with a double-backslash works, and specifying the vector $\\mathbf{x}$ with a double-backslash also works."""
  1. Run lazydocs and push to GitHub.
  2. View the generated documentation Markdown file in GitHub and observe that the natural LaTeX code (with a single backslash) sometimes fails, e.g. at $3 \times 3$ on the first line. (It is supposed to look like on the second line.)

image

Technical details:

Possible Fix:

Additional context:

It would be extremely useful for documenting mathematics implemented in Python code (e.g. machine learning, etc.) for LaTeX to work properly in the documentation without need for modifying the number of backslashes, so that the LaTeX code can be retained properly within the code files.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

dannaf commented 1 month ago

Would appreciate some attention to this issue. Thanks