File tree 10 files changed +101
-34
lines changed
src/mkdocstrings_handlers/python/templates/material
10 files changed +101
-34
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ The following CSS classes are used in the generated HTML:
22
22
- ` doc-labels ` : on ` span ` s wrapping the object's labels
23
23
- ` doc-label ` : on ` small ` elements containing a label
24
24
- ` doc-label-LABEL ` : same, where ` LABEL ` is replaced by the actual label
25
+ - ` doc-md-description ` : on ` div ` s containing HTML descriptions converted from Markdown docstrings
25
26
26
27
/// admonition | Example with colorful labels
27
28
type: example
Original file line number Diff line number Diff line change 21
21
{% endwith %}
22
22
{% endif %}
23
23
</ td >
24
- < td > {{ attribute.description|convert_markdown(heading_level, html_id) }}</ td >
24
+ < td >
25
+ < div class ="doc-md-description ">
26
+ {{ attribute.description|convert_markdown(heading_level, html_id) }}
27
+ </ div >
28
+ </ td >
25
29
</ tr >
26
30
{% endfor %}
27
31
</ tbody >
39
43
(< code > {% include "expression.html" with context %}</ code > )
40
44
{% endwith %}
41
45
{% endif %}
42
- – {{ attribute.description|convert_markdown(heading_level, html_id) }}
46
+ –
47
+ < div class ="doc-md-description ">
48
+ {{ attribute.description|convert_markdown(heading_level, html_id) }}
49
+ </ div >
43
50
</ li >
44
51
{% endfor %}
45
52
</ ul >
58
65
< tr >
59
66
< td > < code > {{ attribute.name }}</ code > </ td >
60
67
< td class ="doc-attribute-details ">
61
- {{ attribute.description|convert_markdown(heading_level, html_id) }}
68
+ < div class ="doc-md-description ">
69
+ {{ attribute.description|convert_markdown(heading_level, html_id) }}
70
+ </ div >
62
71
< p >
63
72
{% if attribute.annotation %}
64
73
< span class ="doc-attribute-annotation ">
Original file line number Diff line number Diff line change 21
21
{% endwith %}
22
22
{% endif %}
23
23
</ td >
24
- < td > {{ parameter.description|convert_markdown(heading_level, html_id) }}</ td >
24
+ < td >
25
+ < div class ="doc-md-description ">
26
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
27
+ </ div >
28
+ </ td >
25
29
</ tr >
26
30
{% endfor %}
27
31
</ tbody >
39
43
(< code > {% include "expression.html" with context %}</ code > )
40
44
{% endwith %}
41
45
{% endif %}
42
- – {{ parameter.description|convert_markdown(heading_level, html_id) }}
46
+ –
47
+ < div class ="doc-md-description ">
48
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
49
+ </ div >
43
50
</ li >
44
51
{% endfor %}
45
52
</ ul >
58
65
< tr >
59
66
< td > < code > {{ parameter.name }}</ code > </ td >
60
67
< td class ="doc-param-details ">
61
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
68
+ < div class ="doc-md-description ">
69
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
70
+ </ div >
62
71
< p >
63
72
{% if parameter.annotation %}
64
73
< span class ="doc-param-annotation ">
Original file line number Diff line number Diff line change 22
22
{% endwith %}
23
23
{% endif %}
24
24
</ td >
25
- < td > {{ parameter.description|convert_markdown(heading_level, html_id) }}</ td >
25
+ < td >
26
+ < div class ="doc-md-description ">
27
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
28
+ </ div >
29
+ </ td >
26
30
< td >
27
31
{% if parameter.default %}
28
32
{% with expression = parameter.default %}
49
53
(< code > {% include "expression.html" with context %}</ code > )
50
54
{% endwith %}
51
55
{% endif %}
52
- – {{ parameter.description|convert_markdown(heading_level, html_id) }}
56
+ –
57
+ < div class ="doc-md-description ">
58
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
59
+ </ div >
53
60
</ li >
54
61
{% endfor %}
55
62
</ ul >
68
75
< tr >
69
76
< td > < code > {{ parameter.name }}</ code > </ td >
70
77
< td class ="doc-param-details ">
71
- {{ parameter.description|convert_markdown(heading_level, html_id) }}
78
+ < div class ="doc-md-description ">
79
+ {{ parameter.description|convert_markdown(heading_level, html_id) }}
80
+ </ div >
72
81
< p >
73
82
{% if parameter.annotation %}
74
83
< span class ="doc-param-annotation ">
Original file line number Diff line number Diff line change 19
19
{% endwith %}
20
20
{% endif %}
21
21
</ td >
22
- < td > {{ raises.description|convert_markdown(heading_level, html_id) }}</ td >
22
+ < td >
23
+ < div class ="doc-md-description ">
24
+ {{ raises.description|convert_markdown(heading_level, html_id) }}
25
+ </ div >
26
+ </ td >
23
27
</ tr >
24
28
{% endfor %}
25
29
</ tbody >
37
41
{% endwith %}
38
42
–
39
43
{% endif %}
40
- {{ raises.description|convert_markdown(heading_level, html_id) }}
44
+ < div class ="doc-md-description ">
45
+ {{ raises.description|convert_markdown(heading_level, html_id) }}
46
+ </ div >
41
47
</ li >
42
48
{% endfor %}
43
49
</ ul >
62
68
</ span >
63
69
</ td >
64
70
< td class ="doc-raises-details ">
65
- {{ raises.description|convert_markdown(heading_level, html_id) }}
71
+ < div class ="doc-md-description ">
72
+ {{ raises.description|convert_markdown(heading_level, html_id) }}
73
+ </ div >
66
74
</ td >
67
75
</ tr >
68
76
{% endfor %}
Original file line number Diff line number Diff line change 22
22
{% endwith %}
23
23
{% endif %}
24
24
</ td >
25
- < td > {{ receives.description|convert_markdown(heading_level, html_id) }}</ td >
25
+ < td >
26
+ < div class ="doc-md-description ">
27
+ {{ receives.description|convert_markdown(heading_level, html_id) }}
28
+ </ div >
29
+ </ td >
26
30
</ tr >
27
31
{% endfor %}
28
32
</ tbody >
42
46
{% if receives.name %}){% endif %}
43
47
{% endwith %}
44
48
{% endif %}
45
- – {{ receives.description|convert_markdown(heading_level, html_id) }}
49
+ –
50
+ < div class ="doc-md-description ">
51
+ {{ receives.description|convert_markdown(heading_level, html_id) }}
52
+ </ div >
46
53
</ li >
47
54
{% endfor %}
48
55
</ ul >
71
78
{% endif %}
72
79
</ td >
73
80
< td class ="doc-receives-details ">
74
- {{ receives.description|convert_markdown(heading_level, html_id) }}
81
+ < div class ="doc-md-description ">
82
+ {{ receives.description|convert_markdown(heading_level, html_id) }}
83
+ </ div >
75
84
{% if receives.name and receives.annotation %}
76
85
< p >
77
86
< span class ="doc-receives-annotation ">
Original file line number Diff line number Diff line change 22
22
{% endwith %}
23
23
{% endif %}
24
24
</ td >
25
- < td > {{ returns.description|convert_markdown(heading_level, html_id) }}</ td >
25
+ < td >
26
+ < div class ="doc-md-description ">
27
+ {{ returns.description|convert_markdown(heading_level, html_id) }}
28
+ </ div >
29
+ </ td >
26
30
</ tr >
27
31
{% endfor %}
28
32
</ tbody >
42
46
{% if returns.name %}){% endif %}
43
47
{% endwith %}
44
48
{% endif %}
45
- – {{ returns.description|convert_markdown(heading_level, html_id) }}
49
+ –
50
+ < div class ="doc-md-description ">
51
+ {{ returns.description|convert_markdown(heading_level, html_id) }}
52
+ </ div >
46
53
</ li >
47
54
{% endfor %}
48
55
</ ul >
71
78
{% endif %}
72
79
</ td >
73
80
< td class ="doc-returns-details ">
74
- {{ returns.description|convert_markdown(heading_level, html_id) }}
81
+ < div class ="doc-md-description ">
82
+ {{ returns.description|convert_markdown(heading_level, html_id) }}
83
+ </ div >
75
84
{% if returns.name and returns.annotation %}
76
85
< p >
77
86
< span class ="doc-returns-annotation ">
Original file line number Diff line number Diff line change 19
19
{% endwith %}
20
20
{% endif %}
21
21
</ td >
22
- < td > {{ warns.description|convert_markdown(heading_level, html_id) }}</ td >
22
+ < td >
23
+ < div class ="doc-md-description ">
24
+ {{ warns.description|convert_markdown(heading_level, html_id) }}
25
+ </ div >
26
+ </ td >
23
27
</ tr >
24
28
{% endfor %}
25
29
</ tbody >
37
41
{% endwith %}
38
42
–
39
43
{% endif %}
40
- {{ warns.description|convert_markdown(heading_level, html_id) }}
44
+ < div class ="doc-md-description ">
45
+ {{ warns.description|convert_markdown(heading_level, html_id) }}
46
+ </ div >
41
47
</ li >
42
48
{% endfor %}
43
49
</ ul >
62
68
</ span >
63
69
</ td >
64
70
< td class ="doc-warns-details ">
65
- {{ warns.description|convert_markdown(heading_level, html_id) }}
71
+ < div class ="doc-md-description ">
72
+ {{ warns.description|convert_markdown(heading_level, html_id) }}
73
+ </ div >
66
74
</ td >
67
75
</ tr >
68
76
{% endfor %}
Original file line number Diff line number Diff line change 22
22
{% endwith %}
23
23
{% endif %}
24
24
</ td >
25
- < td > {{ yields.description|convert_markdown(heading_level, html_id) }}</ td >
25
+ < td >
26
+ < div class ="doc-md-description ">
27
+ {{ yields.description|convert_markdown(heading_level, html_id) }}
28
+ </ div >
29
+ </ td >
26
30
</ tr >
27
31
{% endfor %}
28
32
</ tbody >
42
46
{% if yields.name %}){% endif %}
43
47
{% endwith %}
44
48
{% endif %}
45
- – {{ yields.description|convert_markdown(heading_level, html_id) }}
49
+ –
50
+ < div class ="doc-md-description ">
51
+ {{ yields.description|convert_markdown(heading_level, html_id) }}
52
+ </ div >
46
53
</ li >
47
54
{% endfor %}
48
55
</ ul >
71
78
{% endif %}
72
79
</ td >
73
80
< td class ="doc-yields-details ">
74
- {{ yields.description|convert_markdown(heading_level, html_id) }}
81
+ < div class ="doc-md-description ">
82
+ {{ yields.description|convert_markdown(heading_level, html_id) }}
83
+ </ div >
75
84
{% if yields.name and yields.annotation %}
76
85
< p >
77
86
< span class ="doc-yields-annotation ">
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ h5.doc-heading {
8
8
word-break : normal !important ;
9
9
}
10
10
11
- /* For pieces of Markdown rendered in table cells . */
12
- .doc-contents td p {
13
- margin-top : 0 !important ;
14
- margin-bottom : 0 !important ;
11
+ /* No line break before first paragraph of descriptions . */
12
+ .doc-md-description ,
13
+ . doc-md-description > p : first-child {
14
+ display : inline ;
15
15
}
16
16
17
17
/* Max width for docstring sections tables. */
@@ -20,16 +20,12 @@ h5.doc-heading {
20
20
display : table !important ;
21
21
width : 100% ;
22
22
}
23
+
23
24
.doc .md-typeset__table tr {
24
25
display : table-row;
25
26
}
26
27
27
- /* Avoid line breaks in rendered fields. */
28
- .field-body p {
29
- display : inline;
30
- }
31
-
32
28
/* Defaults in Spacy table style. */
33
29
.doc-param-default {
34
30
float : right;
35
- }
31
+ }
You can’t perform that action at this time.
0 commit comments