import { setSettings } from "../util/settings.js";
import { generateCodeSnippets } from "./codeSnippets/generateCodeSnippets.js";
import { renderContent } from "./content/renderContent.js";
import { getData } from "./data/getDocsData.js";
/**
 * Given an OpenAPI spec, generate Markdown pages of the spec. The returned
 * object is a map of page filenames to page contents.
 */
export async function generatePages({ site, specContents, settings, }) {
    // Save settings to a global location so we can easily access it around the codebase
    setSettings(settings);
    // Get the docs data from the spec
    const data = await getData(specContents);
    // Get code snippets
    let docsCodeSnippets = {};
    if (settings.tryItNow) {
        console.log("Generating Code Snippets");
        docsCodeSnippets = await generateCodeSnippets(data, specContents);
    }
    // Render the content
    console.log("Rendering Markdown");
    return renderContent(site, data, docsCodeSnippets);
}
//# sourceMappingURL=generatePages.js.map