Skip to content

Commit af5c345

Browse files
committed
preview - improve docusaurus fix for the case of hugo-md
1 parent c193049 commit af5c345

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/project/serve/serve.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,21 @@ export async function serveProject(
149149
throw new Error(`${target} is not a project`);
150150
}
151151

152-
const isDocusaurusMd = (
152+
const isMdFormat = (
153+
mdFormat: string,
153154
format?: string | Record<string, unknown> | unknown,
154155
) => {
155156
if (!format) {
156157
return false;
157158
}
158159

159160
if (typeof format === "string") {
160-
return format === "docusaurus-md";
161+
return format === mdFormat;
161162
} else if (typeof format === "object") {
162163
const formats = Object.keys(format);
163164
if (formats.length > 0) {
164165
const firstFormat = Object.keys(format)[0];
165-
return firstFormat === "docusaurus-md";
166+
return firstFormat === mdFormat;
166167
} else {
167168
return false;
168169
}
@@ -174,7 +175,9 @@ export async function serveProject(
174175
// Default project types can't be served
175176
const projType = projectType(project?.config?.project?.[kProjectType]);
176177
if (
177-
projType.type === "default" && !isDocusaurusMd(project?.config?.format)
178+
projType.type === "default" &&
179+
!isMdFormat("docusaurus-md", project?.config?.format) &&
180+
!isMdFormat("hugo-md", project?.config?.format)
178181
) {
179182
const hasIndex = project.files.input.some((file) => {
180183
let relPath = file;

0 commit comments

Comments
 (0)