Skip to content

Commit 537c469

Browse files
committed
comment
1 parent 0efda4a commit 537c469

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/cmd/drill/script.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ document.addEventListener("DOMContentLoaded", function () {
3333
if (typeof hljs !== "undefined") {
3434
hljs.highlightAll();
3535
}
36+
// Make the card content visible, after we've rendered the math and
37+
// highlighted the code.
3638
const cardContent = document.querySelector(".card-content");
3739
if (cardContent) {
3840
cardContent.style.opacity = "1";

src/cmd/drill/template.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ pub fn page_template(body: Markup) -> Markup {
3636
script defer src=(KATEX_MHCHEM_JS_URL) {};
3737
script defer src=(HIGHLIGHT_JS_URL) {};
3838
link rel="stylesheet" href="/style.css";
39+
// See `script.js`. To prevent a flash of un-rendered TeX and
40+
// un-highlighted source code, we make the card content
41+
// invisible until the math rendering and syntax highlighting
42+
// are done. If the browser has JavaScript disabled, however,
43+
// we keep the content visible.
3944
style { ".card-content { opacity: 0; }" }
4045
noscript { style { ".card-content { opacity: 1; }" }}
4146
}

0 commit comments

Comments
 (0)