@@ -246,41 +246,35 @@ export function websiteConfigActions(
246246 }
247247}
248248
249- export function normalizeWebsiteFormat (
249+ // normalize html to first if its included in the formats
250+ export function websiteFormatPreferHtml (
250251 format : string | Record < string , unknown > | undefined ,
251- forceHtml : boolean ,
252- ) : string | Record < string , unknown > {
252+ ) : Record < string , unknown > {
253253 if ( format !== undefined ) {
254254 if ( typeof ( format ) === "string" ) {
255- if ( ! isHtmlOutput ( format , true ) && forceHtml ) {
256- return {
257- html : "default" ,
258- [ format ] : "default" ,
259- } ;
260- } else {
261- return format ;
262- }
255+ return {
256+ [ format ] : "default" ,
257+ } ;
263258 } else {
264259 const formats = Object . keys ( format ) ;
265- const orderedFormats = { } as Record < string , unknown > ;
266- if ( forceHtml ) {
267- const htmlFormatPos = formats . findIndex ( ( format ) =>
268- isHtmlOutput ( format , true )
269- ) ;
270- if ( htmlFormatPos !== - 1 ) {
271- const htmlFormatName = formats . splice ( htmlFormatPos , 1 ) [ 0 ] ;
272- orderedFormats [ htmlFormatName ] = format [ htmlFormatName ] ;
273- } else {
274- orderedFormats [ "html" ] = "default" ;
275- }
260+ const orderedFormats = { } as Record < string , Format > ;
261+
262+ const htmlFormatPos = formats . findIndex ( ( format ) =>
263+ isHtmlOutput ( format , true )
264+ ) ;
265+ if ( htmlFormatPos !== - 1 ) {
266+ const htmlFormatName = formats . splice ( htmlFormatPos , 1 ) [ 0 ] ;
267+ orderedFormats [ htmlFormatName ] = format [ htmlFormatName ] as Format ;
276268 }
277269 for ( const formatName of formats ) {
278- orderedFormats [ formatName ] = format [ formatName ] ;
270+ orderedFormats [ formatName ] = format [ formatName ] as Format ;
279271 }
280272 return orderedFormats ;
281273 }
282274 } else {
283- return "html" ;
275+ return {
276+ html : "default" ,
277+ } ;
284278 }
285279}
286280
@@ -305,15 +299,15 @@ export function formatsPreferHtml(formats: Record<string, unknown>) {
305299export function websiteProjectConfig (
306300 _projectDir : string ,
307301 config : ProjectConfig ,
308- forceHtml : boolean ,
309302 flags ?: RenderFlags ,
310303) : Promise < ProjectConfig > {
311304 config = ld . cloneDeep ( config ) ;
312305 const format = config [ kMetadataFormat ] as
313306 | string
314307 | Record < string , unknown >
315308 | undefined ;
316- config [ kMetadataFormat ] = normalizeWebsiteFormat ( format , forceHtml ) ;
309+
310+ config [ kMetadataFormat ] = websiteFormatPreferHtml ( format ) ;
317311
318312 // Resolve elements to be sure they're arrays, they will be resolve later
319313 const ensureArray = ( val : unknown ) => {
0 commit comments