Repository navigation
Link rcParams role to docs - #11448
Conversation
|
Would setting |
|
Minor point, possibly just an issue to open with sphinx/docutils (although we may get away with applying our own styling, but I'd rather get the issue fixed upstream): https://10444-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/api/_as_gen/matplotlib.axes.Axes.errorbar.html#matplotlib.axes.Axes.errorbar (see errorbar.capsize rc) uses curly quotes for the literal+link, whereas the previous version at https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.errorbar.html#matplotlib.axes.Axes.errorbar uses straight quotes; the latter seems better. |
Curly quotes:They are replaced by For now, the present solution is as good as I can get this (an alternative would only be a raw node). |
| text-decoration: none; | ||
| } | ||
|
|
||
| a.rcparams { |
There was a problem hiding this comment.
Is is really worth it using a different styling (or even a different class)?
I think the normal orange would probably actually look better.
There was a problem hiding this comment.
If we want to use styling, a class is the cleanest way.
To me, the original orange looked a bit too distracting. Can add a screenshot later.
There was a problem hiding this comment.
Let's see what others think, then.
There was a problem hiding this comment.
I'm not sure why it should be distinct. Every other link in the docs, including normal url links, are the same orange.
| 'tutorials/introductory/customizing.html#matplotlib-rcparams') | ||
|
|
||
| ref = nodes.reference(rawtext, rendered, refuri=refuri, | ||
| classes=['rcparams']) |
There was a problem hiding this comment.
would perhaps not bother with the separate class
There was a problem hiding this comment.
Doesn't harm. And makes it easier to adapt the style of the link if desired now or later (e.g. it would also be possible not to have a literal node nested and instead style the font-family of the link).
There was a problem hiding this comment.
(that comment basically just applies if we decide not to style rcs differently from normal links)
| rel_source = inliner.document.attributes['source'].split('/doc/', 1)[1] | ||
| levels = rel_source.count('/') | ||
| refuri = ('../' * levels + | ||
| 'tutorials/introductory/customizing.html#matplotlib-rcparams') |
There was a problem hiding this comment.
use an absolute link? ("/tutorials/...")
There was a problem hiding this comment.
when trying this locally, sphinx links to file:///tutorials/introductory/customizing.html#matplotlib-rcparams
There was a problem hiding this comment.
Perhaps set refid instead of refuri? (just throwing some ideas around -- but somewhere docutils does have the ability to do this, so we just need to find the right way to trigger it...)
There was a problem hiding this comment.
Nope. refid='matplotlib-rcparams' just links to the local anchor #matplotlib-rcparams.
I don't have the time to scan through the docutils docs and try out various stuff. I've posted the question to stackoverflow. If there is no hint from there, I'd leave it at that.
There was a problem hiding this comment.
(I don't think this needs to be resolved to merge this PR -- it's quite unimportant. The only remaining point for me is about the styling.)
|
Removed the css class and special highlighting for the link. It now appears as a regular link. |
|
Concerning curly quotes: This is controlled via the smartquotes option. Maybe, |



PR Summary
Follow up to #10226. This turns the text generated by the
:rc:role into a link to the rc documentation.Note: I'm no expert in docutils and it's really difficult to find good documentation. There generation of the
refurifeels a bit clumsy, because I have to build the final url. Naturally, one would like to have some functionlabel_to_uri('matplotlib-rcparams')but I couldn't find something like that. The downside is that we rely on a hard coded file structure, but I can live with that (We're not likely to change that often).