-
-
Notifications
You must be signed in to change notification settings - Fork 909
Description
Description
On element documentation pages (e.g. /documentation/markdown), the sanitize parameter description appears twice with different levels of detail:
- Demo section (top of page) — shows the full description:
sanitization mode: (default) uses client-side sanitization via setHTML or DOMPurify, disables sanitization (use only with trusted content), or pass a callable to apply server-side sanitization
- Initializer section (under "Reference") — truncated to just:
sanitization mode:
Root cause
In website/documentation/reference.py line 31:
lines = [line.replace(':param ', ':') for line in description.splitlines() if ':param' in line]This list comprehension only keeps lines containing :param. In reStructuredText docstrings, multi-line parameter descriptions use indented continuation lines that don't contain :param:
:param sanitize: sanitization mode:
``True`` (default) uses client-side sanitization via setHTML or DOMPurify,
``False`` disables sanitization (use only with trusted content),
or pass a callable to apply server-side sanitizationOnly the first line (:param sanitize: sanitization mode:) is kept; the three continuation lines are silently dropped.
By contrast, the demo section in website/documentation/rendering.py line 26 uses str.replace() on the full multi-line string, so the continuation lines are preserved there.
This affects every element whose docstring has multi-line :param descriptions — ui.markdown is just one visible example.
NiceGUI Version
3.7.1 (current main)
Python Version
3.10
Browser
Chrome
Operating System
Linux
Note
This issue was filed by Claude Code on behalf of @evnchn