Commit bee7f4e
committed
feat: Fine-grain configuration
This change allows users to specify recursive options under `members`:
```
::: some.module
options:
members:
- name: SomeName
options:
heading: Some Verbose Name
members:
- ...
```
This change also brings a refactor in how we combine default, global and
local configuration. Instead of keeping track of dictionaries to merge
them accordingly, we now chain dataclasses together, using a special
`UNSET` value to tell whether an option was set or not. Checking against
this `UNSET` value lets the chained dataclass know whether it should
try to fetch the value from previous (left/up) dataclasses.
With the following example chain:
```
{ some_option: UNSET } -> { some_option: False } -> { some_option: UNSET
}
```
...trying to get `some_option` from the chain would start with the
right-most dataclass, where `some_option` is `UNSET`. Then it would
continue on the left, and return `False` since it's not `UNSET`. The
left-most dataclass would not be checked since the value was already
returned.
This change lets us simplify templates, as we don't have to check if
we're rendering the root object anymore: the configuration options are
chained in a way that prevent options that are only relevant to the root
object to be propagated further down to members.
Issue-658: mkdocstrings/mkdocstrings#6581 parent 8428783 commit bee7f4e
File tree
15 files changed
+504
-327
lines changed- scripts
- src/mkdocstrings_handlers/python
- _internal
- templates/material/_base
- summary
15 files changed
+504
-327
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
| 48 | + | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
| |||
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| 61 | + | |
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
| |||
0 commit comments