8000 refactor: Deprecate `crossref` and `multi_crossref` filters · mkdocstrings/python@4fe3d20 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4fe3d20

Browse files
committed
refactor: Deprecate crossref and multi_crossref filters
1 parent 8410593 commit 4fe3d20

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/mkdocstrings_handlers/python/rendering.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import enum
66
import re
77
import sys
8+
import warnings
89
from functools import lru_cache
910
from typing import TYPE_CHECKING, Any, Callable, Match, Pattern, Sequence
1011

@@ -131,6 +132,15 @@ def do_order_members(
131132
return sorted(members, key=order_map[order])
132133

133134

135+
@lru_cache
136+
def _warn_crossref() -> None:
137+
warnings.warn(
138+
"The `crossref` filter is deprecated and will be removed in a future version",
139+
DeprecationWarning,
140+
stacklevel=1,
141+
)
142+
143+
134144
def do_crossref(path: str, *, brief: bool = True) -> Markup:
135145
"""Filter to create cross-references.
136146
@@ -141,12 +151,22 @@ def do_crossref(path: str, *, brief: bool = True) -> Markup:
141151
Returns:
142152
Markup text.
143153
"""
154+
_warn_crossref()
144155
full_path = path
145156
if brief:
146157
path = full_path.split(".")[-1]
147158
return Markup("<span data-autorefs-optional-hover={full_path}>{path}</span>").format(full_path=full_path, path=path)
148159

149160

161+
@lru_cache
162+
def _warn_multi_crossref() -> None:
163+
warnings.warn(
164+
"The `multi_crossref` filter is deprecated and will be removed in a future version",
165+
DeprecationWarning,
166+
stacklevel=1,
167+
)
168+
169+
150170
def do_multi_crossref(text: str, *, code: bool = True) -> Markup:
151171
"""Filter to create cross-references.
152172
@@ -157,6 +177,7 @@ def do_multi_crossref(text: str, *, code: bool = True) -> Markup:
157177
Returns:
158178
Markup text.
159179
"""
180+
_warn_multi_crossref()
160181
group_number = 0
161182
variables = {}
162183

0 commit comments

Comments
 (0)
0