MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / buildIndexDoc

Function buildIndexDoc

scripts/docs/src/generate-cli-docs.ts:548–589  ·  view source on GitHub ↗
(commands: Command[], rootName: string)

Source from the content-addressed store, hash-verified

546}
547
548function buildIndexDoc(commands: Command[], rootName: string): CommandDoc {
549 const root: Root = {
550 type: "root",
551 children: [
552 createHeading(2, "Introduction"),
553 createParagraph(
554 `This page aggregates CLI reference docs for ${rootName} commands.`,
555 ),
556 ],
557 };
558
559 commands.forEach((command) => {
560 root.children.push(
561 ...buildCommandSection({
562 command,
563 rootName,
564 ancestors: [],
565 depth: 2,
566 useRootIntro: false,
567 }),
568 );
569 });
570
571 const markdown = toMarkdown(root);
572 const frontmatter = [
573 FRONTMATTER_DELIMITER,
574 `title: ${formatYamlValue(`${rootName} CLI reference`)}`,
575 "seo:",
576 " noindex: true",
577 FRONTMATTER_DELIMITER,
578 "",
579 ].join("\n");
580
581 const mdx = `${frontmatter}${markdown}\n`;
582
583 return {
584 fileName: "index.mdx",
585 markdown,
586 mdx,
587 commandPath: `${rootName} (index)`,
588 };
589}
590
591async function main(): Promise<void> {
592 const repoRoot = getRepoRoot();

Callers 1

mainFunction · 0.85

Calls 6

createHeadingFunction · 0.85
createParagraphFunction · 0.85
buildCommandSectionFunction · 0.85
toMarkdownFunction · 0.85
formatYamlValueFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected