8000 Merge pull request #15115 from ImportanceOfBeingErnest/highlight-rcpa… · matplotlib/matplotlib@bedb4d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit bedb4d9

Browse files
authored
Merge pull request #15115 from ImportanceOfBeingErnest/highlight-rcparams
DOC: highlight rcparams with defaults
2 parents e2638a5 + 75ce592 commit bedb4d9

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Thumbs.db
5656
###################################
5757
lib/matplotlib/mpl-data/matplotlib.conf
5858
lib/matplotlib/mpl-data/matplotlibrc
59+
tutorials/intermediate/CL01.png
60+
tutorials/intermediate/CL02.png
5961

6062
# Documentation generated files #
6163
#################################

doc/_static/mpl.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ span.linkdescr {
594594
font-size: 90%;
595595
}
596596

597+
.highlight span.c1 span.highlighted {
598+
background-color: #fce5a6;
599+
}
600+
597601
ul.search {
598602
margin: 10px 0 0 20px;
599603
padding: 0;

doc/sphinxext/custom_roles.py

Expand all lines: doc/sphinxext/custom_roles.py
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
from docutils import nodes
22
from os.path import sep
3+
from matplotlib import rcParamsDefault
34

45

56
def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
6-
rendered = nodes.Text('rcParams["{}"]'.format(text))
7+
param = rcParamsDefault.get(text)
8+
rendered = nodes.Text(f'rcParams["{text}"] = {param!r}')
79

810
source = inliner.document.attributes['source'].replace(sep, '/')
911
rel_source = source.split('/doc/', 1)[1]
1012

1113
levels = rel_source.count('/')
1214
refuri = ('../' * levels +
13-
'tutorials/introductory/customizing.html#matplotlib-rcparams')
15+
'tutorials/introductory/customizing.html' +
16+
f"?highlight={text}#a-sample-matplotlibrc-file")
1417

1518
ref = nodes.reference(rawtext, rendered, refuri=refuri)
1619
return [nodes.literal('', '', ref)], []

0 commit comments

Comments
 (0)
0