55 *
66 * Copyright (C) 2020-2022 Posit Software, PBC
77 */
8- import { dirname , join , relative } from "../../deno_ral/path.ts" ;
8+ import { join , relative } from "../../deno_ral/path.ts" ;
99import { warning } from "../../deno_ral/log.ts" ;
1010
1111import * as ld from "../../core/lodash.ts" ;
@@ -68,6 +68,7 @@ import {
6868 clipboardDependency ,
6969 createCodeCopyButton ,
7070 kAnchorSections ,
71+ kAxe ,
7172 kBootstrapDependencyName ,
7273 kCitationsHover ,
7374 kCodeAnnotations ,
@@ -116,8 +117,9 @@ import {
116117import { kQuartoHtmlDependency } from "./format-html-constants.ts" ;
117118import { registerWriterFormatHandler } from "../format-handlers.ts" ;
118119import { brandSassFormatExtras } from "../../core/sass/brand.ts" ;
119- import { ESBuildAnalysis , esbuildAnalyze } from "../../core/esbuild.ts" ;
120+ import { ESBuildAnalysis } from "../../core/esbuild.ts" ;
120121import { assert } from "testing/asserts" ;
122+ import { axeFormatDependencies } from "./format-html-axe.ts" ;
121123
122124let esbuildAnalysisCache : Record < string , ESBuildAnalysis > | undefined ;
123125export function esbuildCachedAnalysis (
@@ -245,6 +247,10 @@ export async function htmlFormatExtras(
245247 tippyOptions ?: HtmlFormatTippyOptions ,
246248 scssOptions ?: HtmlFormatScssOptions ,
247249) : Promise < FormatExtras > {
250+ const configurableExtras : FormatExtras [ ] = [
251+ axeFormatDependencies ( format , temp , format . metadata [ kAxe ] ) ,
252+ ] ;
253+
248254 // note whether we are targeting bootstrap
249255 const bootstrap = formatHasBootstrap ( format ) ;
250256
@@ -645,7 +651,7 @@ export async function htmlFormatExtras(
645651 }
646652
647653 const metadata : Metadata = { } ;
648- return {
654+ const result : FormatExtras = {
649655 [ kIncludeInHeader ] : includeInHeader ,
650656 [ kIncludeBeforeBody ] : includeBeforeBody ,
651657 [ kIncludeAfterBody ] : includeAfterBody ,
@@ -657,6 +663,11 @@ export async function htmlFormatExtras(
657663 [ kHtmlPostprocessors ] : htmlPostProcessors ,
658664 } ,
659665 } ;
666+
667+ return mergeConfigs (
668+ result ,
669+ ...configurableExtras ,
670+ ) as FormatExtras ;
660671}
661672
662673const kFormatHasBootstrap = "has-bootstrap" ;
0 commit comments