sphinx_rtd_theme
sphinx_rtd_theme copied to clipboard
layout: allow arbitrary CSS attributes
Allow arbitrary CSS attributes when using app.add_css_file() on Sphinx.
It can be useful e.g. to insert media
or any other attribute. Note
that rel and type are set by default.
Fixes #1100
Does feature for other sphinx themes? This is what the basic theme does, does this syntax work?
{%- for css in css_files %}
{%- if css|attr("filename") %}
{{ css_tag(css) }}
{%- else %}
<link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" />
{%- endif %}
{%- endfor %}
@Blendify thanks for pointing that out! I was not aware of css_tag
.
The change is good, however it requires sphinx 1.8 but currently we support versions down to 1.6 so this will need to be an if else block see https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html#L59 or wait until #1075.
If you use the if else block I will add this to the upcoming 1.0 release.
It seems to merge is blocked however, maybe because you force pushed a commit
We still support Sphinx 1.6 in 1.1... but will be dropped in 2.0. See: https://sphinx-rtd-theme.readthedocs.io/en/stable/development.html#release-2-0-0
any chance this can be merged? @Blendify
Note, this was merged in #1519