I would like to use code folding in bookdown::bs4_book.
I have tried Sébastien Rochette solution and using the hide_code.html from the rtemps package which both produce similar results.
The code folding buttons show up and work to expand the code chunk but only for a second, then it collapses and disappears again.
I think the issue is that both of these option are written for bootstraps 3 and are not compatible with bs4_book? But I don't know javascript so I don't know how to fix it to get it to work.