Skip to content

Commit f1d6aa4

Browse files
committed
add Content-Disposition headers
1 parent ed99c06 commit f1d6aa4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/routes/api/md/$libraryId/$version.docs.framework.$framework.$.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ export const APIRoute = createAPIRoute('/api/md/$libraryId/$version/docs/framewo
2222

2323
const res = await loadDocs(loadDocsArgs)
2424

25-
2625
const { content, description, title} = res
2726

2827
// Generate or fetch the Markdown content dynamically
2928
const markdownContent = `# ${title}\n\n> ${description}\n\n${content}`
3029

30+
const filename = (docsPath || 'file').split('/').join('-')
31+
3132
// Return the Markdown content as a response
3233
return new Response(markdownContent, {
3334
headers: {
3435
'Content-Type': 'text/markdown',
36+
'Content-Disposition': `inline; filename="${filename}.md"`,
3537
},
3638
})
3739
},

0 commit comments

Comments
 (0)