Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target [source] links more accurately in SASS #159

Merged
merged 3 commits into from
Jun 18, 2021

Conversation

sirosen
Copy link
Contributor

@sirosen sirosen commented Jun 8, 2021

This is a patch for #137

It works on the site where I tested it, and doesn't appear to break the kitchen-sink demo.


Because .viewcode-link is already marked with float: right independently, don't assign that style redundantly when styling [source] links attached to function and class defintions.

Use .viewcode-link instead of a.reference.internal to ensure that the styling for [source] links is not accidentally applied to return type annotations which are also internal references.

Because `.viewcode-link` is already marked with `float: right`
independently, don't assign that style redundantly when styling
`[source]` links attached to function and class defintions.

Use `.viewcode-link` instead of `a.reference.internal` to ensure that
the styling for `[source]` links is not accidentally applied to return
type annotations which are also internal references.
In conf.py, modify sys.path to add `kitchen_sink/demo_py/`
This is the approach taken in the sphinx_rtd_theme in order to add an
autodoc'ed module [1].

This module contains a class with one method and a function. This is
more than enough to ensure that autodoc with type annotated methods
and functions is exercised in furo.

[1] https://github.com/readthedocs/sphinx_rtd_theme/blob/671703c3fbb5629fb5004afc941b59310976c28b/docs/conf.py#L10
@sirosen
Copy link
Contributor Author

sirosen commented Jun 8, 2021

I've added a page to the kitchen-sink demo which uses autodoc on an included module.
It shows that this change has the desired effect:
image

I considered putting the desirable module in furo itself as the "demo module", but it seems that path hacking in conf.py is the approach used by the RTD theme. So I figured that was fine for this project as well.

It does make furo's conf.py less pretty, so I'd be happy to move the demo module into furo itself if that's preferable.

Now that the `.viewcode-link` selector is being used, it's not
necessary to try to use `+` to find an adjacent element. The prior
revision dropped this, but did not remove the selectors for elements
neighboring the viewcode-link, resulting in the style not being
applied.
@sirosen
Copy link
Contributor Author

sirosen commented Jun 8, 2021

I noticed that the sizes didn't look quite right in the above screenshot. I've pushed a separate commit with the fix, rather than rebasing or amending, to keep the history here clear. The first version of this PR did not apply the sizing properly to [source] links.

@sirosen
Copy link
Contributor Author

sirosen commented Jun 18, 2021

@pradyunsg, I just want to make sure this is on your radar. I think this is a good fix, and the overlap mentioned in #137 shows up in lots of places on our site's new build using furo. e.g.

link img
sample method (not a permalink) image

@pradyunsg
Copy link
Owner

Thanks for the persistence and clarity in the changes here @sirosen!

@pradyunsg pradyunsg merged commit 2f3b0df into pradyunsg:main Jun 18, 2021
@sirosen sirosen deleted the fix-source-link-alignment branch June 18, 2021 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants