Skip to content

Commit 47238d4

Browse files
committed
chore: Template upgrade
1 parent 0ee2b66 commit 47238d4

File tree

8 files changed

+73
-25
lines changed

8 files changed

+73
-25
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier.
2-
_commit: 1.7.1
2+
_commit: 1.8.4
33
_src_path: gh:pawamoy/copier-uv
44
author_email: [email protected]
55
author_fullname: Timothée Mazzucotelli

docs/css/mkdocstrings.css

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,49 @@ a.autorefs-external::after {
2424
a.external:hover::after,
2525
a.autorefs-external:hover::after {
2626
background-color: var(--md-accent-fg-color);
27-
}
27+
}
28+
29+
/* Tree-like output for backlinks. */
30+
.doc-backlink-list {
31+
--tree-clr: var(--md-default-fg-color);
32+
--tree-font-size: 1rem;
33+
--tree-item-height: 1;
34+
--tree-offset: 1rem;
35+
--tree-thickness: 1px;
36+
--tree-style: solid;
37+
display: grid;
38+
list-style: none !important;
39+
}
40+
41+
.doc-backlink-list li > span:first-child {
42+
text-indent: .3rem;
43+
}
44+
.doc-backlink-list li {
45+
padding-inline-start: var(--tree-offset);
46+
border-left: var(--tree-thickness) var(--tree-style) var(--tree-clr);
47+
position: relative;
48+
margin-left: 0 !important;
49+
50+
&:last-child {
51+
border-color: transparent;
52+
}
53+
&::before{
54+
content: '';
55+
position: absolute;
56+
top: calc(var(--tree-item-height) / 2 * -1 * var(--tree-font-size) + var(--tree-thickness));
57+
left: calc(var(--tree-thickness) * -1);
58+
width: calc(var(--tree-offset) + var(--tree-thickness) * 2);
59+
height: calc(var(--tree-item-height) * var(--tree-font-size));
60+
border-left: var(--tree-thickness) var(--tree-style) var(--tree-clr);
61+
border-bottom: var(--tree-thickness) var(--tree-style) var(--tree-clr);
62+
}
63+
&::after{
64+
content: '';
65+
position: absolute;
66+
border-radius: 50%;
67+
background-color: var(--tree-clr);
68+
top: calc(var(--tree-item-height) / 2 * 1rem);
69+
left: var(--tree-offset) ;
70+
translate: calc(var(--tree-thickness) * -1) calc(var(--tree-thickness) * -1);
71+
}
72+
}

docs/reference/api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: API reference
3+
hide:
4+
- navigation
5+
---
6+
7+
# ::: mkdocs_autorefs

docs/reference/mkdocs_autorefs.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

mkdocs.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ nav:
1919
- Changelog: changelog.md
2020
- Credits: credits.md
2121
- License: license.md
22-
- API reference: reference/mkdocs_autorefs.md
22+
- API reference: reference/api.md
2323
- Development:
2424
- Contributing: contributing.md
2525
- Code of Conduct: code_of_conduct.md
@@ -97,9 +97,10 @@ markdown_extensions:
9797
permalink: "¤"
9898

9999
plugins:
100-
- autorefs
101100
- search
101+
- autorefs
102102
- markdown-exec
103+
- section-index
103104
- coverage
104105
- mkdocstrings:
105106
handlers:
@@ -110,6 +111,7 @@ plugins:
110111
- https://python-markdown.github.io/objects.inv
111112
paths: [src]
112113
options:
114+
backlinks: tree
113115
docstring_options:
114116
ignore_init_summary: true
115117
docstring_section_style: list
@@ -127,11 +129,12 @@ plugins:
127129
signature_crossrefs: true
128130
summary: true
129131
- llmstxt:
130-
files:
131-
- output: llms-full.txt
132-
inputs:
132+
full_output: llms-full.txt
133+
sections:
134+
Usage:
133135
- index.md
134-
- reference/**.md
136+
API:
137+
- reference/api.md
135138
- git-revision-date-localized:
136139
enabled: !ENV [DEPLOY, false]
137140
enable_creation_date: true

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ ci = [
103103
"mkdocs>=1.6",
104104
"mkdocs-coverage>=1.0",
105105
"mkdocs-git-revision-date-localized-plugin>=1.2",
106-
"mkdocs-llmstxt>=0.1",
106+
"mkdocs-llmstxt>=0.2",
107107
"mkdocs-material>=9.5",
108108
"mkdocs-minify-plugin>=0.8",
109-
"mkdocstrings[python]>=0.25",
109+
"mkdocs-section-index>=0.3",
110+
"mkdocstrings[python]>=0.29",
110111
# YORE: EOL 3.10: Remove line.
111112
"tomli>=2.0; python_version < '3.11'",
112113
]

src/mkdocs_autorefs/_internal/references.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _eval_id(self, data: str, index: int, text: str) -> tuple[str | None, str |
190190
if match := HTML_PLACEHOLDER_RE.fullmatch(identifier):
191191
stash_index = int(match.group(1))
192192
html = self.md.htmlStash.rawHtmlBlocks[stash_index]
193-
identifier = Markup(html).striptags()
193+
identifier = Markup(html).striptags() # noqa: S704
194194
self.md.htmlStash.rawHtmlBlocks[stash_index] = escape(identifier)
195195

196196
# In any other case, unstash the title and slugify it.

tests/test_api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import griffe
1010
import pytest
11-
from mkdocstrings.inventory import Inventory
11+
from mkdocstrings import Inventory
1212

1313
import mkdocs_autorefs
1414

@@ -154,7 +154,11 @@ def test_inventory_matches_api(
154154
public_api_paths.add("mkdocs_autorefs")
155155
ignore = {"mkdocs_autorefs.plugin", "mkdocs_autorefs.references"}
156156
for item in inventory.values():
157-
if item.domain == "py" and "(" not in item.name:
157+
if (
158+
item.domain == "py"
159+
and "(" not in item.name
160+
and (item.name == "mkdocs_autorefs" or item.name.startswith("mkdocs_autorefs."))
161+
):
158162
obj = loader.modules_collection[item.name]
159163
if (
160164
obj.path not in ignore

0 commit comments

Comments
 (0)