Comments (8)
If you leave them you don't get mkdocs styling. Mkdocs 3, from which the css was taken, is strict about which tables it will apply styling to. I don't think this can be changes without making a heroic effort to move forward for a full update.
from sphinx-material.
Thanks for the fast answer and your help.
Based on your hint, I took a look into the css-code and indeed there are 12 css definitions in /sphinx_material/static/stylesheets/application.css
, which uses selectors like table:not([class])
.
So this selector is valid, as long as no class is set. (I don't get it, why they solved it this way, but okay...).
I don't see any reason (yet), why this css-defintions should not be set if a class is available for a table.
So maybe there is the chance, that everything is still working, if we copy these 12 occurrences to application-fixes.css
and remove this not([class])
stuff.
Would this be a valid solution? For sure, only if everything looks the same afterwards.
If yes, I would be happy to create the PR for this.
from sphinx-material.
I was wrong. The problem is not part of any css code.
It is this line https://github.com/bashtage/sphinx-material/blob/main/sphinx_material/__init__.py#L242
I understand the point, that we only get material-styling (css), if the tables do not have any css class.
The problem is, that a theme can not make a general assumption here and simply remove every class from every table.
I would like to use the implemented logic the other way around.
There is a predefined list of table css classes. If only these classes can be found, then table['class']
gets deleted.
If more as the predefined classes are found, table['class']
stays untouched or maybe just the predefined classes get removed (have to figure out).
And as we know sphinx and doctuils, it shouldn't be so hard to get the needed classe names for this list.
This would allow any extension to set table classes and provide css code on its own.
Any feedback or hints, why this would not work?
from sphinx-material.
I suppose I don't really want to break this theme for anyone who uses it by inverting the selection. I don't disagree that this is a hacky fix.
In a perfect world there would be a truly sphinx-specific rewrite of the CSS (or SCSS and then derive CSS from this). That requires an effort beyond what I can do for this project. There is another thread where there is vocal support for updating, although no one was come forward with enough bandwidth to formally provide a well-supported alternative.
from sphinx-material.
The problem is that the theme can not be used with any extension, which uses tables to structure its own data.
So this them is not an option, if it shall be used with an extension like sphinx-needs.
But I totally agree that a fix must be backwards compatible.
There was a similar issue with the ReadTheDocs theme, as some Javascript manipulates table classes as well.
See readthedocs/sphinx_rtd_theme#1179.
There we found the solution to check if a specific css-class is set (.rtd-exclude-wy-table
).
If this is the case, this specific table stays untouched.
I think this can be a solution here as well and I as an extension developer must care about setting this class, to avoid theme specific table handling.
So here my new proposal :)
If table["css"]
contains no_material_handling
, then all tables css classes are kept.
Feel free to change this name...
So everything stays as it is, as long as nobody set this specific table-class.
Test
I made a quick test and deactivated the handling for sphinx-needs tables:
Before:
After deactivating handling for specific tables:
Would this be a valid way?
And for sure I would be happy to create the PR, if I get your GO.
from sphinx-material.
A sentinel value does sound like a very good and very-likely to be backward compatible. Now to gnash teeth on what the value should be :-). no-material-strip
or more specific no-sphinx-material-strip
(or handle). It should also be settable to a list of classes, even if there is a default value (also so that the default could be set to nothing, i.e., a empty list.
from sphinx-material.
Ok, so here the (final?) proposal:
html_theme_options = {
table_classes = [] # already exists and stays untouched by this change
table_no_strip = [] # new
}
If table_no_strip
is not defined, it will be set to ['no-sphinx-material-strip']
.
If it contains a list, e.g. ['no_handling']
, then also no-sphinx-material-strip
will be added. Final result table_no_strip = ['no_handling', 'no-sphinx-material-strip']
.
If table_no_strip
is set to []
or None
, the list stays empty and even no-sphinx-material-strip
will not bet set.
Hopefully I got all your points.
I will try to provide a PR till end of this week.
from sphinx-material.
Sounds like a good fix.
from sphinx-material.
Related Issues (20)
- Allow arbitrary colors for "color_primary" HOT 2
- Documentation for "logo_icon" HOT 3
- ENH: allow for image file as `logo_icon`? HOT 2
- html_minify doesn't work with the 'dirhtml' builder HOT 1
- Permalink buttons are invisible HOT 1
- One extra character has gray background in inline :code:`Foo` HOT 1
- 0.0.35: sphinx fails with call trace in `sphinx_material/__init__.py`
- 0.0.35: `pytest --black` fails
- Google HOT 1
- weird rendering of longtable in material
- Toctree not shown in sidebar HOT 1
- High contrast color scheme option
- Search results shows up with Please activate JavaScript ... error HOT 10
- Translation
- default localtoc title quotes
- Can't get my logo to show up in the header HOT 1
- Extension broken since Sphinx 7.2.0
- Tag the 0.0.36 release HOT 1
- FUTURE: sphinx-material's future
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sphinx-material.