Skip to content

Commit 3c7b998

Browse files
committed
doc: support for tabs (pymdownx.tabbed)
Signed-off-by: Jan Larwig <[email protected]>
1 parent 9f46035 commit 3c7b998

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,29 @@ document$.subscribe(({ body }) => {
107107
})
108108
```
109109

110+
## Using Tabs (pymdownx.tabbed)
111+
112+
If you want to use drawio diagrams inside of tabs you need to make sure that the diagrams are processed after the tabs are rendered. You can achieve this by adding the following javascript to your `mkdocs.yml`:
113+
114+
```yaml
115+
extra_javascript:
116+
- javascripts/drawio-tabs.js
117+
```
118+
119+
Add `docs/javascripts/drawio-tabs.js` to your project:
120+
121+
```js
122+
document.addEventListener('change', (event) => {
123+
// Check if the target is a pymdownx tab input
124+
if (event.target.matches('.tabbed-set > input')) {
125+
GraphViewer.processElements()
126+
}
127+
});
128+
```
129+
130+
Its a bit of a workaround as it listens for all events on the page and retriggers the drawio processing if any tab is clicked.
131+
132+
110133
## How it works
111134

112135
1. mkdocs generates the html per page

0 commit comments

Comments
 (0)