diff --git a/monorepo/DocumentationIntelligence/DocumentationIntelligence.php b/monorepo/DocumentationIntelligence/DocumentationIntelligence.php index 8b3d60599f3..44be61b45fc 100644 --- a/monorepo/DocumentationIntelligence/DocumentationIntelligence.php +++ b/monorepo/DocumentationIntelligence/DocumentationIntelligence.php @@ -199,6 +199,17 @@ public function createPrunedModel(): void } $model = $uniqueLines; + // Pass where we move single word-lines to a new line + $aloneWords = []; + foreach ($model as $index => $line) { + if ((str_word_count($line) === 1) && (! Str::startsWith($line, '- '))) { + $aloneWords[] = $line; + unset($model[$index]); + } + } + $imploded = implode('. ', $aloneWords); + $model[] = "\n".$imploded; + $model = implode("\n", $model); // Remove multiple newlines