bashtage / sphinx-material

A material-based, responsive theme inspired by mkdocs-material
Other
317 stars 91 forks source link

cssclass being stripped from tables #44

Open JoKneeMo opened 4 years ago

JoKneeMo commented 4 years ago

This page of the docs https://bashtage.github.io/sphinx-material/additional_samples.html#tables says that you can use cssclass on a table as shown below. But if you look at the source, css class is not being used.

When using docutils, the class directive on a table adds the css class. It seems that this theme is stripping those when it changes docutils classes to md.

It is also removing the footnote class, so those can not be styled differently when this theme.

bashtage commented 4 years ago

Looks like a bug.

JoKneeMo commented 4 years ago

If I may suggest an enhancement to this: The ignore_table_classes in sphinx_material/init.py works. It would be great if I could define additional classes to ignore from the conf.py.

The only issue I have with the existing ignore_table_classes is that it skips the table altogether. Right now, if I set a table class to longtable, the final table's classes would be longtable docutils and it is not wrapped in a div. Instead, I think it should strip the classes from the table, and wrap it in a div with the classes md-typeset__table longtable so that it functions just like this other tables.

bashtage commented 4 years ago

Half-way fixed in #46

bashtage commented 4 years ago

You can now whitelist any style you want to keep on a table. You have to fully style tables though.

bashtage commented 4 years ago

The text in the passage you mentioned was wrong and was from a different theme. It has been corrected now.