Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1af7495

Browse files
committed
Link rcParams role to docs
1 parent 341070a commit 1af7495

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

doc/_static/mpl.css

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

26+
a:hover {
27+
color: #2491CF;
28+
}
29+
2630
div.highlight-python a {
2731
color: #CA7900;
2832
}
@@ -35,10 +39,6 @@ strong {
3539
font-weight: strong;
3640
}
3741

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

doc/sphinxext/custom_roles.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
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+
return [nodes.literal('', '', ref)], []
714

815

916
def setup(app):

0 commit comments

Comments
 (0)