Open
Description
The Mermaid printer in pyreverse incorrectly renders Python dunder methods and attributes. Double underscores (__
) are output directly to Mermaid, which interprets them as Markdown bold formatting (**text**
) instead of literal underscores.
This can be observed in the functional test files
The file contains entries like:
class P {
name : str
__init__(name: str)
}
class SpecialAttr {
__x__
__init__()
}
When viewed in a Mermaid renderer, __init__
and __x__
display as bold text instead of showing the literal underscores.
Command used:
pyreverse -o mmd --filter-mode=ALL tests/pyreverse/functional/class_diagrams/aggregation_filtering/all.py
Pylint output:
The generated .mmd
file contains unescaped double underscores that render incorrectly in Mermaid viewers.
Expected behavior:
Double underscores in method and attribute names should render as literal underscores in Mermaid diagrams, not as bold formatting.
Pylint version:
pylint 4.0.0-dev0
astroid 4.0.0a0
Python 3.13.2 (main, Feb 12 2025, 14:49:53) [MSC v.1942 64 bit (AMD64)]