Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ragaeeb/kokokor/llms.txt
Use this file to discover all available pages before exploring further.
Function Signature
src/index.ts:11
Description
Formats an array of text blocks into a readable string with proper paragraph breaks and spacing. This is the final stage of the paragraph reconstruction pipeline. The function handles:- Proper line breaks between paragraphs
- Extra spacing after headings
- Optional symbol insertion before the first footnote
- Preservation of document structure through formatting
Parameters
Array of text blocks to format. These are typically paragraph-level blocks from
mapTextLinesToParagraphs.Each TextBlock can have:text: The paragraph contentisHeading: If true, adds extra spacing after the headingisFootnote: If true andfooterSymbolis provided, adds symbol before first footnote
Optional symbol to insert before the first footnote.Common values:
"---"- Horizontal rule separator"***"- Asterisk separator"\n---\n"- Separator with extra spacing"[Footnotes]"- Text label
Returns
Formatted text string with proper line breaks and spacing.
- Paragraphs are separated by single newlines
- Headings have an extra blank line after them
- Footer symbol (if provided) appears before the first footnote
- All content is joined with newline characters
Example
Example without Footer Symbol
Formatting Rules
| Block Type | Formatting |
|---|---|
| Regular paragraph | Single newline separator |
Heading (isHeading: true) | Text + empty line (double newline) |
First footnote with footerSymbol | Symbol on its own line + footnote text |
| Subsequent footnotes | Single newline separator |
Notes
- The function uses a single-pass algorithm for efficiency
- Footer symbol is inserted only once, before the first footnote
- Headings automatically get extra spacing for visual separation
- The output is plain text suitable for display or further processing
- Line breaks use
\n(newline) characters