Skip to main content
Defined in: streaming/split.ts:521 Split text into parts that fit limit: a max length in UTF-16 code units, or SplitTextOptions with maxLength, maxBytes (UTF-8) and the markup format. Cuts land on natural boundaries (paragraph, line, sentence, word), never inside a grapheme or a markup entity; a fenced block, inline code, emphasis run or HTML element longer than the limit is closed and reopened across parts. Whitespace at a cut is dropped (the indentation of the next line is kept); whitespace-only parts are dropped. Run time is linear in the length of text (its markup is scanned once).

Parameters

Returns

string[]

Example