Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/format/html/format-html-axe.ts
6450 views
1
/*
2
* format-html-axe.ts
3
*
4
* Copyright (C) 2020-2025 Posit Software, PBC
5
*/
6
7
import { kIncludeInHeader } from "../../config/constants.ts";
8
import { Format, FormatExtras } from "../../config/types.ts";
9
import { TempContext } from "../../core/temp-types.ts";
10
import { encodeBase64 } from "../../deno_ral/encoding.ts";
11
12
export function axeFormatDependencies(
13
_format: Format,
14
temp: TempContext,
15
options?: unknown,
16
): FormatExtras {
17
if (!options) return {};
18
19
return {
20
[kIncludeInHeader]: [
21
temp.createFileFromString(
22
`<script id="quarto-axe-checker-options" type="text/plain">${
23
encodeBase64(JSON.stringify(options))
24
}</script>`,
25
),
26
],
27
html: {
28
"sass-bundles": [
29
{
30
key: "axe",
31
dependency: "bootstrap",
32
user: [{
33
uses: "",
34
defaults: "",
35
functions: "",
36
mixins: "",
37
rules: `
38
body div.quarto-axe-report {
39
position: fixed;
40
bottom: 3rem;
41
right: 3rem;
42
padding: 1rem;
43
border: 1px solid $body-color;
44
}
45
46
.quarto-axe-violation-help { padding-left: 0.5rem; }
47
.quarto-axe-violation-selector { padding-left: 1rem; }
48
.quarto-axe-violation-target {
49
padding: 0.5rem;
50
color: $link-color;
51
text-decoration: underline;
52
cursor: pointer;
53
}
54
55
.quarto-axe-hover-highlight {
56
background-color: red;
57
border: 1px solid $body-color;
58
}`,
59
}],
60
},
61
],
62
},
63
};
64
}
65
66