File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,10 @@ Configuration Options
103103``table_classes ``
104104 A list of classes to **not strip ** from tables. All other classes are stripped, and the default
105105 table has no class attribute. Custom table classes need to provide the full style for the table.
106-
106+ ``table_no_strip ``
107+ A list of classes to deactivate the complete table handling by sphinx-material for this specific table,
108+ so that all set table classes are kept.
109+ Default value: ``no-sphinx-material-strip ``.
107110Sidebars
108111========
109112
Original file line number Diff line number Diff line change 2222ROOT_SUFFIX = "--page-root"
2323
2424USER_TABLE_CLASSES = []
25+ USER_TABLE_NO_STRIP_CLASSES = ["no-sphinx-material-strip" ]
2526
2627
2728def setup (app ):
@@ -150,6 +151,10 @@ def update_table_classes(app, config):
150151 if table_classes :
151152 USER_TABLE_CLASSES .extend (table_classes )
152153
154+ table_no_strip_classes = config .html_theme_options .get ("table_no_strip" )
155+ if table_no_strip_classes :
156+ USER_TABLE_NO_STRIP_CLASSES .extend (table_no_strip_classes )
157+
153158
154159def html_theme_path ():
155160 return [os .path .dirname (os .path .abspath (__file__ ))]
@@ -228,7 +233,9 @@ def walk_contents(tags):
228233
229234def table_fix (body_text , page_name = "md-page-root--link" ):
230235 # This is a hack to skip certain classes of tables
231- ignore_table_classes = {"highlighttable" , "longtable" , "dataframe" }
236+ ignore_table_classes = {"highlighttable" , "longtable" , "dataframe" } | set (
237+ USER_TABLE_NO_STRIP_CLASSES
238+ )
232239 try :
233240 body = BeautifulSoup (body_text , features = "html.parser" )
234241 for table in body .select ("table" ):
Original file line number Diff line number Diff line change @@ -109,4 +109,9 @@ version_json = "versions.json"
109109# Table classes to _not_ strip. Must be a list. Classes on this list are *not*
110110# removed from tables. All other classes are removed, and only tables with outclasses
111111# are styled by default.
112- table_classes =
112+ table_classes =
113+
114+ # Table classes, which deactivates the overall class striping. If one of the configured
115+ # classes is set, **all** table classes are kept.
116+ # This is different to "table_classes", which only keeps the configured classes.
117+ table_no_strip =
You can’t perform that action at this time.
0 commit comments