evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a documentation site generator that processes MDX files with custom layouts.
You need to create a tool that:
When an MDX file exports a default layout component, that layout should wrap the content. The layout component should receive props including children (the MDX content itself) and any other props passed during render.
When no default layout is exported from the MDX file, but a wrapper component is provided through props.components, that wrapper should be used instead.
The layout precedence is: exported default layout takes priority over wrapper prop.
The compilation should produce executable code that can be run to get the MDX module, which includes:
/**
* Compiles and evaluates MDX content with layout support.
*
* @param {string} mdxContent - The MDX source code to compile
* @param {object} options - Compilation options including components
* @returns {Promise<object>} The compiled MDX module
*/
async function compileMDXWithLayout(mdxContent, options) {
// IMPLEMENTATION HERE
}
module.exports = { compileMDXWithLayout };Provides MDX compilation and evaluation support with layout system capabilities.