// toggle visibility of R source blocks in R Markdown output (d => { d.insertAdjacentHTML('beforeend',''); d.lastElementChild.onclick = (e) => { d.querySelectorAll('pre.r').forEach(el => { el.style.display = (el.style.display === 'none') ? 'block' : 'none'; }); }; })(document.body);