Night-mode styling, French cross-references, and the log through Part VI
- theme.scss and figures draw with the extension's --calc-… tokens; light/dark pair plus the high-contrast button; a11y highlight style for html - figure labels split so none leaves its viewBox in any language - _quarto-fr.yml: French cross-reference prefixes - notes extension synced to 2.8.18 - conv/: Parts IV, V and VI logged, pasted terminal output redacted Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
afb816f459
commit
f7fa60ba81
62 files changed
+3552
-852
No files matched your search
@@ -385,16 +385,54 @@ function Meta(m)
|
||||
if m.notecolor then
|
||||
notecolor = pandoc.utils.stringify(m.notecolor)
|
||||
end
|
||||
local notecolor_dark = m["notecolor-dark"] ~= nil
|
||||
and pandoc.utils.stringify(m["notecolor-dark"]) or nil
|
||||
if quarto == nil or quarto.doc == nil then return end -- plain pandoc: skip injection
|
||||
if fmt_is("html") then
|
||||
quarto.doc.add_html_dependency({
|
||||
name = "calc-notes",
|
||||
version = "1.0.0",
|
||||
stylesheets = { "calc-notes.css" },
|
||||
stylesheets = { "theme.css", "high-contrast.css", "calc-notes.css", "narrow.css" },
|
||||
scripts = { "calc-notes.js" },
|
||||
})
|
||||
quarto.doc.include_text("in-header",
|
||||
"<style>:root { --calc-notecolor: " .. notecolor .. "; }</style>")
|
||||
-- `-src` holds the book's own colour, which theme.css lifts for a dark
|
||||
-- page rather than replacing; `-dark` is a book's explicit override.
|
||||
quarto.doc.include_text("in-header", table.concat({
|
||||
"<style>:root {",
|
||||
" --calc-notecolor-src: " .. notecolor .. ";",
|
||||
" --calc-notecolor: var(--calc-notecolor-src);",
|
||||
notecolor_dark and (" --calc-notecolor-dark: " .. notecolor_dark .. ";") or "",
|
||||
"}</style>",
|
||||
}, "\n"))
|
||||
-- Mark <html> while the head is still parsing, so high-contrast.css is in
|
||||
-- force before the first paint and the page never flashes the ordinary
|
||||
-- palette. Three ways in, in this order of precedence: what the reader
|
||||
-- last picked with the toggle in the navigation bar, `high-contrast: true`
|
||||
-- in the book, and the reader's own system setting, which is watched so
|
||||
-- that changing it takes effect without a reload.
|
||||
local forced = (m["high-contrast"] == true) or
|
||||
(m["high-contrast"] ~= nil and pandoc.utils.stringify(m["high-contrast"]) == "true")
|
||||
quarto.doc.include_text("in-header", table.concat({
|
||||
"<script>(function (e) {",
|
||||
" var KEY = 'notes-contrast', forced = " .. (forced and "true" or "false") .. ";",
|
||||
" var picked = null;",
|
||||
" try { picked = localStorage.getItem(KEY); } catch (err) {}",
|
||||
" var q = null;",
|
||||
" try { q = window.matchMedia && window.matchMedia('(prefers-contrast: more)'); } catch (err) {}",
|
||||
" if (picked === 'more' || (picked !== 'normal' && (forced || (q && q.matches)))) {",
|
||||
" e.classList.add('hc');",
|
||||
" }",
|
||||
" if (q) {",
|
||||
" var f = function () {",
|
||||
" var p = null;",
|
||||
" try { p = localStorage.getItem(KEY); } catch (err) {}",
|
||||
" if (p === null) e.classList.toggle('hc', forced || q.matches);",
|
||||
" };",
|
||||
" if (q.addEventListener) q.addEventListener('change', f);",
|
||||
" else if (q.addListener) q.addListener(f);",
|
||||
" }",
|
||||
"})(document.documentElement);</script>",
|
||||
}, "\n"))
|
||||
elseif fmt_is("latex") then
|
||||
quarto.doc.use_latex_package("mathtools") -- \Aboxed
|
||||
quarto.doc.use_latex_package("xcolor")
|
||||
|
||||
Reference in new issue
Block a user