Skip to content

Commit

Permalink
Update plugin.py
Browse files Browse the repository at this point in the history
Handle tables inside tabbed elements
  • Loading branch information
Thomzoy authored Mar 5, 2024
1 parent 5292098 commit b483601
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions mkdocs_glightbox/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ def prune(elem):
pruned = elem
del pruned["class"] # For uniform styling
parent = pruned.parent
found_first_parent = False

while parent is not None: # and "html" not in parent.name:
if parent.get("class", None) is None:
if (parent.get("class", None) is None) or ("tabbed" in parent.get("class", "")) :
parent = parent.parent
continue
if not found_first_parent:
# Centering the table in its immediate parent div
parent["style"] = "text-align: center"
# Adding an "open" attribute for collapsible sections
parent["open"] = ""
found_first_parent = True

parent["style"] = "text-align: center"
# Adding an "open" attribute for collapsible sections
parent["open"] = ""
parent.clear()
parent.append(pruned)
pruned = parent
Expand Down

0 comments on commit b483601

Please sign in to comment.