Skip to content

Commit

Permalink
WIP figure environment fix
Browse files Browse the repository at this point in the history
  • Loading branch information
James Goldie committed Sep 24, 2024
1 parent a9bdd06 commit d5583d1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion _extensions/closeread/_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ contributes:
page-layout: full
execute:
echo: false

include-after-body:
file:
protect-stickies.html
33 changes: 33 additions & 0 deletions _extensions/closeread/protect-stickies.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script id="closeread-exclude-from-quarto-grid" type="application/javascript">

// remove .column-* and other classes from elements inside .cr-section
window.document.addEventListener("DOMContentLoaded", function (event) {

// remove .page-columns and .page-full from .c-section itself
const crSections = window.document.querySelectorAll(".cr-section");

crSections.forEach(el => {
console.log("Removing classes from .cr-section...");
el.classList.remove("page-full", "page-columns");
});

console.log("Looking for offending .column-* or .page-columns inside .cr-section...")

const allColumnEls =
window.document.querySelectorAll(
".cr-section .page-columns, .cr-section .column-screen");

allColumnEls.forEach(el => {
const badClasses =
[...el.classList].filter(c => c.startsWith("column-"));
console.log("Removing classes from el: ", badClasses)
el.classList.remove("page-full", "page-columns", ...badClasses);
});


// TODO - what we do about about ancestors between .cr-section and main
// that have also been affected? no way to know whether they were supposed
// to get them...

});
</script>

0 comments on commit d5583d1

Please # to comment.