Skip to content

fix: escape underscores in docstring markdown titles#422

Open
kapsner wants to merge 2 commits intomachow:mainfrom
kapsner:main
Open

fix: escape underscores in docstring markdown titles#422
kapsner wants to merge 2 commits intomachow:mainfrom
kapsner:main

Conversation

@kapsner
Copy link
Copy Markdown

@kapsner kapsner commented Feb 6, 2026

Issue: When documenting private or protected class members that contain leading underscore(s) _ in their name (e.g., __init__, __call__, _some_other_private_member, etc.), rendering a pdf-book (and docx) results in broken headings (i.e., the {#module.import.path.class.__member__}-part is visible in the final document).

Solution: This PR introduces the escaping of underscores in the display-name of docstring headers:
https://github.com/kapsner/quartodoc/blob/a2c1cade88504efe5bb4798980e110d43cc7b06b/quartodoc/renderers/md_renderer.py#L393

Verification: On my local system, I could verify that this PR fixes the faulty behaviour for pdf- and docx-format (For html, I only checked after implementing this and everything looks fine as well, however, I have not checked, if the faulty behaviour previously also occurred for html-documents).

Best, Lorenz

@kapsner
Copy link
Copy Markdown
Author

kapsner commented Feb 19, 2026

Hi @machow , just wanted to know, if the purpose of this PR is clear enough, or if you want me to add more information / details / tests or something else?
Best, Lorenz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant