Skip to content

Commit c44e030

Browse files
committed
Link rcParams role to docs
1 parent 932fd81 commit c44e030

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

doc/_static/mpl.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ a {
2323
text-decoration: none;
2424
}
2525

26+
a.rcparams {
27+
color: #814D00;
28+
}
29+
30+
a:hover, a.rcparams:hover {
31+
color: #2491CF;
32+
}
33+
2634
div.highlight-python a {
2735
color: #CA7900;
2836
}
@@ -35,10 +43,6 @@ strong {
3543
font-weight: strong;
3644
}
3745

38-
a:hover {
39-
color: #2491CF;
40-
}
41-
4246
pre {
4347
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
4448
font-size: 0.90em;

doc/sphinxext/custom_roles.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33

44
def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
55
rendered = nodes.Text('rcParams["{}"]'.format(text))
6-
return [nodes.literal(rawtext, rendered)], []
6+
7+
rel_source = inliner.document.attributes['source'].split('/doc/', 1)[1]
8+
levels = rel_source.count('/')
9+
refuri = ('../' * levels +
10+
'tutorials/introductory/customizing.html#matplotlib-rcparams')
11+
12+
ref = nodes.reference(rawtext, rendered, refuri=refuri,
13+
classes=['rcparams'])
14+
return [nodes.literal('', '', ref)], []
715

816

917
def setup(app):

0 commit comments

Comments
 (0)