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

Docs: Fix custom styling, restore bullets #12581

Closed
wants to merge 3 commits into from

Conversation

ferdnyc
Copy link

@ferdnyc ferdnyc commented Jul 6, 2024

  • Move the custom CSS to a dedicated pytest.css file in _static/, and reference it from the configuraton's html_css_files list.
  • Update the list-customization styling to only affect .sidebar-scroll (the navigation sidebar), so that bullets are visible in the rest of the documentation.
  • Remove the list indent from the navigation sidebar, but only at the top level, so that navigation is still nested with visible indents.

Fixes #12573
Fixes #12576
Closes #12575
Updates #12290
Updates #12326

Before

image

After

image

- Move the custom CSS to a dedicated `pytest.css` file in `_static/`,
  and reference it from the configuraton's `html_css_files` list.
- Update the list-customization styling to only affect `.sidebar-scroll`
  (the navigation sidebar), so that bullets are visible in the rest
  of the documentation.
- Remove the list indent from the navigation sidebar, but only at the
  top level, so that navigation is still nested with visible indents.
Comment on lines +1 to +4
/* Hide list bullets and top-level indent in TOC sidebar */
.sidebar-scroll ul {list-style: none;}
.sidebar-scroll > ul {padding-left: 0;}
.sidebar-scroll li {margin: 0.4em 0;}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A slight change from @pradyunsg's #12575, as I discovered that the navigation sidebar isn't styled .sidebar (surprisingly), but the events sidebar is. So, nesting these changes under .sidebar would've hit the wrong part of the docs.

The navigation content-list is under a div at .sidebar-drawer > .sidebar-container > .sidebar-scroll.

I suppose I could've used either of those parent selectors instead, except for the .sidebar-scroll > ul change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, this was not meant for TOC sidebar at all. It's meant for the literal "sidebar" thing in reStructuredText: https://pradyunsg.me/furo/kitchen-sink/generic/#sidebar

Copy link
Contributor

@pradyunsg pradyunsg Jul 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that folks didn't like the extra indentation that having list within sidebar, specifically due to lack of width for content in an already thin sidebar.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no, pytest devs want list markers in the event sidebar. The original CSS this replaces was intended to remove them only from the TOC/navigation sidebar, but it was overzealous by a lot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, fun.

@ferdnyc ferdnyc force-pushed the new-theme-styles branch from 782516d to 3fc478e Compare July 6, 2024 08:56
pre-commit-ci bot and others added 2 commits July 6, 2024 08:56
- Prevents it accidentally sitting directly "on top" of other page
  elements, when the widths work out exactly wrong
@ferdnyc
Copy link
Author

ferdnyc commented Jul 6, 2024

I added an additional commit with a small style fix, as IMHO this looks extremely unfortunate:

image

With the added margin it becomes this, which is perfect:

image

@nicoddemus nicoddemus added skip news used on prs to opt out of the changelog requirement backport 8.2.x labels Jul 6, 2024
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @ferdnyc, we greatly appreciate you following up here. ❤️

I have skimmed through the docs and everything looks great to me. 👍

Comment on lines +2 to +4
.sidebar-scroll ul {list-style: none;}
.sidebar-scroll > ul {padding-left: 0;}
.sidebar-scroll li {margin: 0.4em 0;}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.sidebar-scroll ul {list-style: none;}
.sidebar-scroll > ul {padding-left: 0;}
.sidebar-scroll li {margin: 0.4em 0;}
.sidebar ul {
list-style: none;
padding-left: 0;
}
.sidebar ul li {
margin: 0.4em 0;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna say this isn't necessary because I clearly misunderstood what the goals were here.

@pradyunsg
Copy link
Contributor

I'm only now noticing the completely custom sidebar in pytest's documentation. I'll file a separate issue/PR about that, I guess.

@pradyunsg
Copy link
Contributor

I've filed #12584 for that.

@pradyunsg
Copy link
Contributor

FWIW, I don't consider my PR to be "competing" with this one and have no concerns with this landing -- I'm happy to rebase mine once this one goes through. I realise that might not have been clear with my previous two comments. 😅

@nicoddemus
Copy link
Member

Sorry I'm not keen on all the details so I must ask: @pradyunsg in your opinion is this PR ready to merge?

@nicoddemus
Copy link
Member

@ferdnyc @pradyunsg gentle ping

@ferdnyc
Copy link
Author

ferdnyc commented Jul 24, 2024

@nicoddemus @pradyunsg

To be honest, I thought this was already handled with the other PRs that have already been merged. I'll take a look at the current state of the docs and see if anything here is still needed.

@ferdnyc
Copy link
Author

ferdnyc commented Jul 24, 2024

Hmm. Looking at https://docs.pytest.org/en/latest/, list bullets are already back in the main content. They're not shown in the trainings & events sidebar, but the excessive indentation that was being caused when they were hidden is also gone, and I'm not sure my changes here would affect that anyway.

And the main/navigation sidebar is completely changed from the previous configs, so my changes there no longer have any purpose.

As for the behind-the-scenes changes, the CSS is already moved from _templates/style.html to _static/pytest-custom.css.

I'm not sure there's anything left to do in this PR. All of the linked issues/PRs are already closed/merged. I think it's best to just close this one; everything it was trying to do is handled already.

@ferdnyc ferdnyc closed this Jul 24, 2024
@nicoddemus
Copy link
Member

Thanks @ferdnyc!

@ferdnyc ferdnyc deleted the new-theme-styles branch July 24, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news used on prs to opt out of the changelog requirement
Projects
None yet
4 participants