MCPcopy Create free account
hub / github.com/dailydotdev/apps / isMarkdownRequest

Function isMarkdownRequest

packages/webapp/proxy.ts:104–125  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

102};
103
104const isMarkdownRequest = (req: NextRequest): boolean => {
105 const { pathname } = req.nextUrl;
106
107 if (
108 pathname.startsWith('/api/md/') ||
109 MARKDOWN_PAGE_PATHS.includes(pathname)
110 ) {
111 return true;
112 }
113
114 if (!pathname.startsWith(POSTS_PREFIX)) {
115 return false;
116 }
117
118 const id = pathname.slice(POSTS_PREFIX.length);
119
120 return (
121 !!id &&
122 !id.includes('/') &&
123 (id.endsWith('.md') || acceptsMarkdown(req.headers.get('accept')))
124 );
125};
126
127// Prerendered pages are cached per path, so the shell has to be part of the
128// path: the mirror renders the laptop chrome (rail + floating card) in the

Callers 1

proxyFunction · 0.85

Calls 1

acceptsMarkdownFunction · 0.90

Tested by

no test coverage detected