@@ -50,7 +50,7 @@ export interface Config {
50
50
sidebar : boolean ; // defaults to true if pages isn’t empty
51
51
pages : ( Page | Section < Page > ) [ ] ;
52
52
pager : boolean ; // defaults to true
53
- scripts : Script [ ] ; // defaults to empty array
53
+ scripts : Script [ ] ; // deprecated; defaults to empty array
54
54
head : string | null ; // defaults to null
55
55
header : string | null ; // defaults to null
56
56
footer : string | null ; // defaults to “Built with Observable on [date].”
@@ -201,7 +201,7 @@ export function normalizeConfig(spec: ConfigSpec = {}, defaultRoot?: string, wat
201
201
const pager = spec . pager === undefined ? true : Boolean ( spec . pager ) ;
202
202
const toc = normalizeToc ( spec . toc as any ) ;
203
203
const sidebar = spec . sidebar === undefined ? undefined : Boolean ( spec . sidebar ) ;
204
- const scripts = spec . scripts === undefined ? [ ] : Array . from ( spec . scripts as any , normalizeScript ) ;
204
+ const scripts = spec . scripts === undefined ? [ ] : normalizeScripts ( spec . scripts ) ;
205
205
const head = spec . head === undefined ? "" : stringOrNull ( spec . head ) ;
206
206
const header = spec . header === undefined ? "" : stringOrNull ( spec . header ) ;
207
207
const footer = spec . footer === undefined ? defaultFooter ( ) : stringOrNull ( spec . footer ) ;
@@ -270,6 +270,11 @@ export function normalizeTheme(spec: unknown): string[] {
270
270
return resolveTheme ( typeof spec === "string" ? [ spec ] : spec === null ? [ ] : Array . from ( spec as any , String ) ) ;
271
271
}
272
272
273
+ function normalizeScripts ( spec : unknown ) : Script [ ] {
274
+ console . warn ( `${ yellow ( "Warning:" ) } the ${ bold ( "scripts" ) } option is deprecated; use ${ bold ( "head" ) } instead.` ) ;
275
+ return Array . from ( spec as any , normalizeScript ) ;
276
+ }
277
+
273
278
function normalizeScript ( spec : unknown ) : Script {
274
279
const script = typeof spec === "string" ? { src : spec } : ( spec as ScriptSpec ) ;
275
280
const src = String ( script . src ) ;
0 commit comments