MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / _getMDXContent

Function _getMDXContent

apps/site/next.dynamic.mjs:174–185  ·  view source on GitHub ↗
(source = '', filename = '')

Source from the content-addressed store, hash-verified

172 * @param {string} filename
173 */
174 const _getMDXContent = async (source = '', filename = '') => {
175 // We create a VFile (Virtual File) to be able to access some contextual
176 // data post serialization (compilation) of the source Markdown into MDX
177 const sourceAsVirtualFile = new VFile(source);
178
179 // Gets the file extension of the file, to determine which parser and plugins to use
180 const fileExtension = filename.endsWith('.mdx') ? 'mdx' : 'md';
181
182 // This compiles our MDX source (VFile) into a final MDX-parsed VFile
183 // that then is passed as a string to the MDXProvider which will run the MDX Code
184 return compile(sourceAsVirtualFile, fileExtension, mdxComponents);
185 };
186
187 // Creates a Cached Version of the MDX Compiler
188 const getMDXContent = cache(async (source, filename) => {

Callers 1

getDynamicRouterFunction · 0.85

Calls 1

compileFunction · 0.85

Tested by

no test coverage detected