Skip to content

Commit f9592b9

Browse files
committed
fix(docs): drop deprecated-badge tooltip instead of sanitizing it
Removing the `title=` tooltip on the deprecated badge avoids the reST markup leak entirely, so the `plainifyForTooltip()` helper added in ce02c8a is no longer needed. This mirrors the approach taken in PR #6421 (commit 2a794af). - Revert drag_target.py docs_reason strings to mkdocs-style links. - Drop `title` from the SummarySection Badge and stop carrying `deprecation` through `memberSummary`. - Remove the now-unused `plainifyForTooltip` from crocodocs utils.
1 parent c6f8359 commit f9592b9

3 files changed

Lines changed: 9 additions & 42 deletions

File tree

sdk/python/packages/flet/src/flet/controls/core/drag_target.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,8 @@ def __post_init__(self):
7777
@deprecated(
7878
reason="Use `local_position.x` for target-relative coordinates or "
7979
"`global_position.x` for global coordinates instead.",
80-
docs_reason=(
81-
"Use :attr:`~flet.DragTargetEvent.local_position`.x for "
82-
"target-relative coordinates or "
83-
":attr:`~flet.DragTargetEvent.global_position`.x for global "
84-
"coordinates instead."
85-
),
80+
docs_reason="Use [`local_position.x`](../types/dragtargetevent.md#flet.DragTargetEvent.local_position) for target-relative coordinates or " # noqa: E501
81+
"[`global_position.x`](../types/dragtargetevent.md#flet.DragTargetEvent.global_position) for global coordinates instead.", # noqa: E501
8682
version="0.85.0",
8783
delete_version="0.88.0",
8884
)
@@ -97,12 +93,8 @@ def x(self) -> float:
9793
@deprecated(
9894
reason="Use `local_position.y` for target-relative coordinates or "
9995
"`global_position.y` for global coordinates instead.",
100-
docs_reason=(
101-
"Use :attr:`~flet.DragTargetEvent.local_position`.y for "
102-
"target-relative coordinates or "
103-
":attr:`~flet.DragTargetEvent.global_position`.y for global "
104-
"coordinates instead."
105-
),
96+
docs_reason="Use [`local_position.y`](../types/dragtargetevent.md#flet.DragTargetEvent.local_position) for target-relative coordinates or " # noqa: E501
97+
"[`global_position.y`](../types/dragtargetevent.md#flet.DragTargetEvent.global_position) for global coordinates instead.", # noqa: E501
10698
version="0.85.0",
10799
delete_version="0.88.0",
108100
)
@@ -117,12 +109,8 @@ def y(self) -> float:
117109
@deprecated(
118110
reason="Use `local_position` for target-relative coordinates or "
119111
"`global_position` for global coordinates instead.",
120-
docs_reason=(
121-
"Use :attr:`~flet.DragTargetEvent.local_position` for "
122-
"target-relative coordinates or "
123-
":attr:`~flet.DragTargetEvent.global_position` for global "
124-
"coordinates instead."
125-
),
112+
docs_reason="Use [`local_position`](../types/dragtargetevent.md#flet.DragTargetEvent.local_position) for target-relative coordinates or " # noqa: E501
113+
"[`global_position`](../types/dragtargetevent.md#flet.DragTargetEvent.global_position) for global coordinates instead.", # noqa: E501
126114
version="0.85.0",
127115
delete_version="0.88.0",
128116
)

website/src/components/crocodocs/ClassBlock.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
firstSentenceFromDocstring,
77
getApiData,
88
memberAnchor,
9-
plainifyForTooltip,
109
renderCodeExpression,
1110
renderDocstring,
1211
renderDocstringSections,
@@ -291,14 +290,13 @@ function renderMethod(item, classSymbol, docId) {
291290

292291
/**
293292
* Build the compact member data used by ClassSummary lists.
294-
* Carries labels/deprecation metadata so summary rows can show important badges
295-
* without requiring readers to scroll to the full member documentation.
293+
* Carries labels so summary rows can show important badges without requiring
294+
* readers to scroll to the full member documentation.
296295
*/
297296
function memberSummary(item, kind) {
298297
return {
299298
name: item.name,
300299
kind,
301-
deprecation: item.deprecation,
302300
labels: item.labels ?? [],
303301
summary: firstSentenceFromDocstring(item.docstring, item.docstring_sections),
304302
};
@@ -338,12 +336,7 @@ function SummarySection({title, items, classSymbol}) {
338336
{" "}
339337
<span className="crocodocs-member-badges crocodocs-summary-badges">
340338
{labels.map((label) => (
341-
<Badge
342-
key={label}
343-
title={label === "deprecated" ? plainifyForTooltip(item.deprecation) : undefined}
344-
>
345-
{label}
346-
</Badge>
339+
<Badge key={label}>{label}</Badge>
347340
))}
348341
</span>
349342
</>

website/src/components/crocodocs/utils.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,6 @@ function formatRestXrefLabel(target) {
396396
return hasCall ? `${display}()` : display;
397397
}
398398

399-
/**
400-
* Flatten reST xrefs and inline backticks to plain text for use in HTML `title`
401-
* attributes (tooltips), which don't render Markdown or reST.
402-
*/
403-
export function plainifyForTooltip(text) {
404-
if (!text) {
405-
return text;
406-
}
407-
const roleRe = /:(?:py:)?(?:class|attr|meth|func|data|mod|obj):`([^`\n]+)`/g;
408-
return text
409-
.replace(roleRe, (_, target) => formatRestXrefLabel(target))
410-
.replace(/`([^`\n]+)`/g, "$1");
411-
}
412-
413399
/**
414400
* Resolve a reStructuredText cross-reference (:py:class:`Foo`, :attr:`bar`, etc.) to a href and label.
415401
* Tries local member resolution, then class context, then full symbol lookup, then base class walking.

0 commit comments

Comments
 (0)