Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/middleware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export const onRequest = defineMiddleware(async (context, next) => {
"accept-encoding": "identity",
},
});
} else if (pathname.endsWith("/index.md")) {
} else if (
pathname.endsWith("/index.md") ||
context.request.headers.get("accept")?.includes("text/markdown")
) {
const htmlUrl = new URL(pathname.replace("index.md", ""), context.url);
const html = await (await fetch(htmlUrl)).text();

Expand Down
5 changes: 4 additions & 1 deletion worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export default class extends WorkerEntrypoint<Env> {
});
}

if (request.url.endsWith("/index.md")) {
if (
request.url.endsWith("/index.md") ||
request.headers.get("accept")?.includes("text/markdown")
) {
const htmlUrl = request.url.replace("index.md", "");
const res = await this.env.ASSETS.fetch(htmlUrl, request);

Expand Down
Loading