-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Avoid stripping table classes #119
Comments
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. |
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 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 Would this be a valid solution? For sure, only if everything looks the same afterwards. |
I was wrong. The problem is not part of any css code. I understand the point, that we only get material-styling (css), if the tables do not have any css class. I would like to use the implemented logic the other way around. 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? |
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. |
The problem is that the theme can not be used with any extension, which uses tables to structure its own data. But I totally agree that a fix must be backwards compatible. There we found the solution to check if a specific css-class is set ( 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 So everything stays as it is, as long as nobody set this specific table-class. TestI made a quick test and deactivated the handling for sphinx-needs tables: After deactivating handling for specific tables: Would this be a valid way? |
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 :-). |
Ok, so here the (final?) proposal:
If If it contains a list, e.g. If Hopefully I got all your points. |
Sounds like a good fix. |
Allows the user to define table classes, which deactivates the complete table handling by sphinx-material for this specific table. * Adds table_no_strip to theme.conf * Sets default value to no-sphinx-material-strip Fixes bashtage#119
Allows the user to define table classes, which deactivates the complete table handling by sphinx-material for this specific table. * Adds table_no_strip to theme.conf * Sets default value to no-sphinx-material-strip * Adds docs on customization page Fixes bashtage#119
Why do the table-classes get all stripped?
I know I can have a whitelist for classes, which should stay (table_classes), but the overall behavior makes no sense for me, as it
destroys a lot of information which is important for the tables and their styles.
Up to now I personal don't see any technical reason for this. Please tell me if I'm wrong.
Proposal
Leave all tables classes as they are set by sphinx/docutils/extensions
Use case
I'm the maintainer of a Sphinx-extension called Sphinx-Needs.
This extension uses multiple tables to present data.
Some tables are used to define requirements or specification. Some are used as a "normal" table to give an overview about e.g. 30 requirements. And some are even used and get transformed by a JS-lib called DataTables.
All these tables can be styled. E.g. an open requirement table is green, a closed one red.
And all these styles and different kind of tables are handled by various css classes and the user can even define own ones.
So there are dozens of css-classes defined for tables.
Sphinx-Material completely destroys this mechanism by ignoring such information, which is coming from the docutils-nodetree.
Last words
I'm totally open to help here and provide a PR, mainly because I love this theme a lot ❤️
But it would be helpful for me to understand the reasons for this behavior and maybe discuss already technical solutions.
The text was updated successfully, but these errors were encountered: