Skip to content

docs: switch theme to furo #3335

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

Merged
merged 11 commits into from
Dec 10, 2020
Merged

docs: switch theme to furo #3335

merged 11 commits into from
Dec 10, 2020

Conversation

bastimeyer
Copy link
Member

@bastimeyer bastimeyer commented Nov 13, 2020

Resolves #2851

This switches the docs theme from the custom sphinx_rtd_theme_violet theme to furo:
https://github.com/pradyunsg/furo

  • Sets furo docs requirement to ==2020.12.09.beta21, as it's changing quickly with breaking changes due to not having a major release yet
  • Sets sphinx docs requirement to >=3.0, as it's a requirement of furo

As usual, everything is grouped into logical commits with a proper description in the commit messages.


Current theme modifications

  • Added logo, project title, oneliner and version selection, which now remembers the current page when switching. Since this all pushes the main menu down by a bit, I've tried to minimize the height as much as possible.
  • Added proper brand colors, so that it matches the Streamlink icon colors. This makes the menu links a bit darker, but this is preferred, so that it's "out of focus" while reading the page content.
  • Fixed the font sizes of various components and removed the 110% font-size media query on "large screens", as it's stupid and makes the font a bit blurry (16px*1.1 = 17.6px).
  • Improved the font-stack a bit by adding more names for Apple's San Francisco font.
  • Fixed scrollbar issues in both sidebars with custom styles overrides. This should now work on all display resolutions.

Additional docs changes

  • Changed the style of the inline :command:s from bold text to inline code.
  • Split the plugin arguments list into nested groups, so that it's easier to find them via the second TOC menu.

Remaining issues

None


Thoughts

  • The CLI argument default values should be placed right under the argument names, so that they don't appear in the middle of the description. This can be done by improving the regex in the argparse extension and by adding a special syntax to the argument descriptions for this. Not sure how to connect these changes with the HTML output, as the man pages need to keep working.

image

image

@bastimeyer bastimeyer force-pushed the docs/furo branch 2 times, most recently from c44cf01 to 026f81d Compare November 14, 2020 10:29
@bastimeyer bastimeyer changed the title docs: switch to furo theme docs: switch theme to furo Nov 14, 2020
@bastimeyer
Copy link
Member Author

The recent push

  • fixed remaining scrollbar and content width issues in the sidebars due to the sidebar customization
  • fixed the brand colors on the dark theme
  • fixed the --help output with nested argument groups
  • reduced the size of the logo a bit, so that the menu moves further up
  • added favicons and a PWA manifest (progressive web apps)

Once furo has had its next release (see remaining issues), I'm going to rebase and resolve the merge conflict (#3379). The PR should then be pretty much ready from my side at least. Please build the docs locally and review.

pip install -U -r docs-requirements.txt
make --directory=docs clean html
xdg-open ./docs/_build/html/index.html

pinpoint furo to `2020.12.09.beta21` for now
- Add custom CSS stylesheet
- Fix sidebar brand+version section and add back the oneliner text
- Adjust logo and text sizes
- Add back stable/latest links and remember the current page
- Add back Github buttons below the main menu
@bastimeyer bastimeyer removed the WIP Work in process label Dec 9, 2020
@bastimeyer
Copy link
Member Author

Please build the docs on your systems and give this a final review.

@gravyboat
Copy link
Member

@bastimeyer I'm getting the following build error on my Windows box, might be okay elsewhere:

\docs\index.rst:62:toctree contains reference to document 'changelog' that doesn't have a title: no link will be generated
make: *** [Makefile:45: html] Error 2

@bastimeyer
Copy link
Member Author

bastimeyer commented Dec 9, 2020

$ stat -c %N docs/changelog.md 
'docs/changelog.md' -> '../CHANGELOG.md'

Your git-for-Windows is misconfigured and doesn't create symbolic links.

core.symlinks=true

@gravyboat
Copy link
Member

@bastimeyer No it's not that. I already have developer mode enabled and have symlinks enabled for git both globally and for the repo itself. I'll continue investigating.

@bastimeyer
Copy link
Member Author

You'll have to re-clone the repo, because otherwise it'll just create file copies, and you probably have an older version of that file there and/or maybe it's empty, because it complains about a missing document title in the changelog file. I don't know how this is handled on Windows. Just use a POSIX environment to build it if you're having trouble getting it to work.

@gravyboat
Copy link
Member

I did. It was some problem with make itself. Uninstalling and installing the latest via chocolatey fixed it. The docs look good even on my 1440p monitor. I'm marking this as approved.

@gravyboat gravyboat self-requested a review December 9, 2020 22:36
Copy link
Member

@gravyboat gravyboat left a comment

Choose a reason for hiding this comment

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

Looks good, if no one else has feedback let's merge this.

@bastimeyer
Copy link
Member Author

bastimeyer commented Dec 9, 2020

We've talked about this in another PR (can't remember which one), but a docs preview deploy config for PRs would be very useful sometimes.

Just had a look at netlify for the past hour or so:
https://www.netlify.com/blog/2016/07/20/introducing-deploy-previews-in-netlify/

Here's a PR on my test repo with docs deploy statuses:
https://github.com/bastimeyer-test/streamlink-test/pull/8
https://deploy-preview-8--streamlink-test.netlify.app/

Unless I'm mistaken, there doesn't seem to be a way though to make it only build on PR, because we don't want to build on push to master. Auto-building can be disabled so that the content has to be deployed manually from GH actions, but according to some comments on the netlify GH issues, their CLI tool for manually deploying content doesn't support setting PR statuses. This means that the preview-URL would only be printed to stdout in the GH actions build log, which isn't ideal.

Another issue is that it also always triggers a build, which doesn't make sense for non-docs related changes. We could add another GH actions workflow that only triggers on change in certain paths, and make it build and deploy the docs via the netlify CLI tool. The preview URL could be added via a comment from the streamlink-bot account via a custom script.

There's a way to configure it to our needs. Well, almost, but it's good enough. The master branch does not get built, neither do PRs with unrelated changes and the PR status doesn't spam anymore. So if you want docs previews on netlify, I can create an acc with the streamlink protonmail address and set it up. Requires a PR here first with a netlify.toml config, the rest can be configured on their website.

@gravyboat
Copy link
Member

@bastimeyer I want to merge this tomorrow. Do you want to squash down some of these commits or do you prefer they stay?

Regarding Netlify it seems like a pretty good option, unfortunately we can't used the shared account as it would violate their terms of service:

Each user must have unique login credentials that may not to be shared by multiple users.

That would make it pretty annoying to manage unless we want to pay and current monthly opencollective contributions would be entirely eaten by just two users at $20 USD each.

- Use Streamlink's brand colors
- Add more names for Apple's San Francisco font to global font stack
- Remove 110% font-size media query on "large" screens
- Fix font-size of inline code elements
- Reduce height of main menu items by a bit
- Add back custom table styles used on the install page
- Fix style of :command: directive
- Fix font weight of active TOC item and add a little icon
and fix font sizes+weights of the admonition component
- Add back font-awesome icons (and switch from v4 to v5)
- Add back Github avatar styles
This adds a second layer of plugin argument groups, so that the docs can
show menu items for each plugin which makes finding them is easier.

- make the doc's argparse extension read argparse groups recursively
- override argparse.ArgumentParser.format_help and show nested groups
- fix/update tests
- theme issue workaround: set width of scrollbar content, so that the
  scrollbar doesn't shrink the available space once it appears
- theme issue workaround: add padding-right to TOC content, so that the
  text doesn't touch the scrollbar
- make TOC scrollbar transparent while not hovering it, as it's
  distracting otherwise on large TOC lists
@bastimeyer
Copy link
Member Author

bastimeyer commented Dec 10, 2020

Fixed an issue with the TOC tree and the current item having bold font-weight, which caused some texts to wrap due to the larger width. The current item in the TOC tree now has a little icon next to it ("TRIANGULAR BULLET" - U+2023).

The commits are grouped into logical chunks and should not be squashed any further. All I can do is squash the :command: commit into the fonts commit, which I just did.

Regarding netlify, FOSS projects can apply for a different plan. They only show this option if you're signed in.

edit: forgot a link... /ping @gravyboat

@gravyboat
Copy link
Member

gravyboat commented Dec 10, 2020

@bastimeyer That's what I figured regarding the commits but wanted to double check. I'll rebase and merge.

Regarding netlify, I'm not a big fan of some of their requirements for this:

Features a Code of Conduct at the top level directory of the project repository or prominently in the documentation (with a link in the navigation, footer, or homepage).

We've never had a code of conduct and I don't see a reason to create one now to appease some company.

Must feature a link to our service on your main page, or all internal pages. You have two options:

    We have premade badges for your convenience, or
    You may create your own link, which should read “This site is powered by Netlify”, and include a link back to our home page.

This requirement is ridiculous. They want prominent placement on the documentation? Absolutely not assuming that this has to apply to more than just the preview build. If they want us to advertise they can sponsor us.

The plan is also still limited to the free usage tier per the bottom of that document so we don't even get anything out of it other than multiple accounts, and let's be real how many people are going to be logging in regularly? It's just a way for them to get free advertising out of us without actually offering anything of significance.

Edit:

I'd rather just use the free tier and only one person has access to it than use their open source plan. Yeah it sucks for bus factor but bending to their demands sucks more.

@gravyboat gravyboat merged commit f62dd98 into streamlink:master Dec 10, 2020
@bastimeyer
Copy link
Member Author

@gravyboat Yes, the requirements are a bit ridiculous, but I guess this is mostly meant for projects which want their website to be hosted by them. We only want to preview simple documentation builds, so the requirements don't necessarily have to fully apply to us. If you're okay with this, I'll send them a support email first and ask if it's possible for Streamlink to apply to their open source plan without meeting all strict requirements. If they still insist on us having a CoC, I've already got one for you "be nice and respectful". And if this doesn't work out, I can manage the account on my own just fine, I guess. Nobody else needs to login there anyway and if something breaks or gets annoying, the netlify integration can be removed from the repo here.

The plan is also still limited to the free usage tier per the bottom of that document

Their open source plan is the same as the pro plan with unlimited members (see the top), which would be nice in regards to the monthly build time limitation. The link at the bottom just says that they can disable the account at any time if they want, similar to the free/gratis tier.

@gravyboat
Copy link
Member

@bastimeyer I'm fine with sending them a support email with your proposed details. Let's see what they say. I'm also fine with that CoC if we have to add one. I don't want to put more management work on you is my main problem with the whole process, it just sucks when one person has to handle everything related to a specific aspect of the project.

The link at the bottom just says that they can disable the account at any time if they want, similar to the free/gratis tier.

Ahh my misunderstanding then.

@bastimeyer
Copy link
Member Author

I'm a little bit annoyed. You can't send them a regular support email, not even via the support form on their site unless you're a paying customer and you'll have to use the community forums instead. I don't want to post this there. Sent it on the enterprise contact form instead, lol...

@gravyboat
Copy link
Member

Yikes. I can understand not wanting to support customers who don't pay but that seems a bit extreme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion to replace custom sphinx theme with official sphinx rtd theme
3 participants