This repository was archived by the owner on Mar 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ {% macro sphinx_imports () -%}
2+ import logging
3+ from typing import Any
4+ {% - endmacro %}
5+
6+ {% macro sphinx_setup () -%}
7+ class UnexpectedUnindentFilter(logging.Filter):
8+ """Filter out warnings about unexpected unindentation following bullet lists."""
9+
10+ def filter(self, record: logging.LogRecord) -> bool:
11+ """Filter the log record.
12+
13+ Args:
14+ record (logging.LogRecord): The log record.
15+
16+ Returns:
17+ bool: False to suppress the warning, True to allow it.
18+ """
19+ msg = record.getMessage()
20+ if "Bullet list ends without a blank line" in msg:
21+ return False
22+ return True
23+
24+
25+ def setup(app: Any) -> None:
26+ """Setup the Sphinx application.
27+
28+ Args:
29+ app (Any): The Sphinx application.
30+ """
31+ # Sphinx's logger is hierarchical. Adding a filter to the
32+ # root 'sphinx' logger will catch warnings from all sub-loggers.
33+ logger = logging.getLogger('sphinx')
34+ logger.addFilter(UnexpectedUnindentFilter())
35+ {% - endmacro %}
Original file line number Diff line number Diff line change @@ -375,5 +375,6 @@ napoleon_use_ivar = False
375375napoleon_use_param = True
376376napoleon_use_rtype = True
377377
378+ # Setup for sphinx behaviors such as warning filters.
378379{{ sphinx_setup() }}
379380{% endblock %}
You can’t perform that action at this time.
0 commit comments