# core/renderers/faq.renderer.ts

> 37 lines of code and 4 definitions.

Tree: Build tree
Language: typescript
Layer: product
Canonical: https://banes-lab.com/anatomy/build#file-build-core-renderers-faq-renderer-ts
Source text: https://banes-lab.com/assets/sources/source.49723c59dfabde54c4bbd57c2e4645238fc2d8d1dca3caaf89a590b7886d65a1.generated.txt

## Definitions

- `renderFaq` (lexical_declaration, line 30, exported)
- `question` (lexical_declaration, line 14)
- `rule` (lexical_declaration, line 15)
- `groups` (lexical_declaration, line 31, exported)

## Uses

- [core/renderers/markdown.renderer.ts](https://banes-lab.com/source/build/core/renderers/markdown.renderer.ts.md)

## Source

```typescript
import { CHAPTER_SEPARATOR, PARAGRAPH_BREAK } from "#configuration/constants/chapter.constants";
import {
    DETAILS_CLOSE,
    DETAILS_OPEN,
    HEADING_THREE,
    SUMMARY_CLOSE,
    SUMMARY_OPEN,
} from "#configuration/constants/readme.constants";
import { FAQ_TITLE } from "#configuration/strings/readme.strings";
import { LINE_END } from "#configuration/constants/inventory.constants";
import type { ReadmePage } from "#types/readme.types";
import { section } from "#core/renderers/markdown.renderer";

const question = function question(title: string, content: string | null): string {
    const rule = CHAPTER_SEPARATOR.trim();
    return [
        DETAILS_OPEN,
        SUMMARY_OPEN + title + SUMMARY_CLOSE,
        "",
        rule,
        "",
        content ?? "",
        "",
        rule,
        "",
        DETAILS_CLOSE,
    ].join(LINE_END);
};

export const renderFaq = function renderFaq(page: ReadmePage): string {
    const groups = page.tabs
        .flatMap((tab) => tab.sections)
        .map((held) =>
            [HEADING_THREE + held.title, ...held.subsections.map((sub) => question(sub.title, sub.content))].join(
                PARAGRAPH_BREAK,
            ),
        );
    return section(FAQ_TITLE, ...groups);
};
```
