Created
October 22, 2020 14:09
-
-
Save gadenbuie/0f46ab12fe81ea8ff8df0ca875e9f1ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var divHTML = document.querySelectorAll(".details"); | |
divHTML.forEach(function (el) { | |
let title = [...el.classList].filter(s => !s.match(/details|open/)) | |
el.outerHTML = '<details ' + | |
(el.classList.contains("open") ? "open " : "") + | |
'class="output"><summary>' + | |
(title.length ? title : 'Details') + | |
'</summary>' + | |
el.innerHTML + | |
'</details>'; | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For xaringan slides, converts something like
into