executablebooks / sphinx-tabs

Tabbed views for Sphinx
https://sphinx-tabs.readthedocs.io
MIT License
263 stars 67 forks source link

[fix] don't append CSS files to the end of html_static_path list #153

Closed return42 closed 2 years ago

return42 commented 2 years ago

html_static_path is a list of paths that contain custom static files. They are copied to the output’s _static directory after the theme’s static files, so a file named default.css will overwrite the theme’s default.css [1]

Without this patch a tabs.css can't be overwritten by the conf.py file:

html_static_path = [ 'static/tabs.css', ]

The /static folder from sphinx-tabs needs to be added in front of html_static_path since the last item in the list will be written last to /_static.

[1] https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path

Signed-off-by: Markus Heiser markus.heiser@darmarit.de

welcome[bot] commented 2 years ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.
Welcome to the EBP community! :tada:

foster999 commented 2 years ago

Thanks for this, I hadn't considered that someone would want to overwrite the CSS file(s) for a plugin!

Please could you add a line to our Sphinx docs to describe how a user would do this in their sphinx conf?

return42 commented 2 years ago

Please could you add a line to our Sphinx docs to describe how a user would do this in their sphinx conf?

IMO this is not needed, it is the common solution to overwrite static files (images, CSS, JS ..) and is described in the Spinx framework, see html_static_path. By example: this was the first I tried to implement a workaround for #152.

codecov[bot] commented 2 years ago

Codecov Report

Merging #153 (887062b) into master (53b6a63) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #153   +/-   ##
=======================================
  Coverage   92.69%   92.69%           
=======================================
  Files           2        2           
  Lines         219      219           
=======================================
  Hits          203      203           
  Misses         16       16           
Flag Coverage Δ
pytests 92.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sphinx_tabs/tabs.py 92.62% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 53b6a63...887062b. Read the comment docs.

welcome[bot] commented 2 years ago

Congrats on your first merged pull request in this project! :tada: congrats
Thank you for contributing, we are very proud of you! :heart: