system/Typography/Typography.php
protected function formatNewLines(string $str): string
	{
		if ($str === '' || ( strpos($str, "\n") === false && ! in_array($this->lastBlockElement, $this->innerBlockRequired)))
		{
			return $str;
		}

		// Convert two consecutive newlines to paragraphs
		$str = str_replace("\n\n", "</p>\n\n<p>", $str);

		// Convert single spaces to <br /> tags
		$str = preg_replace("/([^\n])(\n)([^\n])/", '\\1<br />\\2\\3', $str);

		// Wrap the whole enchilada in enclosing paragraphs
		if ($str !== "\n")
		{
			// We trim off the right-side new line so that the closing </p> tag
			// will be positioned immediately following the string, matching
			// the behavior of the opening <p> tag
			$str = '<p>' . rtrim($str) . '</p>';
		}

		// Remove empty paragraphs if they are on the first line, as this
		// is a potential unintended consequence of the previous code
		return preg_replace('/<p><\/p>(.*)/', '\\1', $str, 1);
	}
protected function formatNewLines(string $str): string
	{
		if ($str === '' || ( strpos($str, "\n") === false && ! in_array($this->lastBlockElement, $this->innerBlockRequired)))
		{
			return $str;
		}

		// Convert two consecutive newlines to paragraphs
		$str = str_replace("\n\n", "</p>\n\n<p>", $str);

		// Convert single spaces to <br /> tags
		$str = preg_replace("/([^\n])(\n)([^\n])/", '\\1<br />\\2\\3', $str);

		// Wrap the whole enchilada in enclosing paragraphs
		if ($str !== "\n")
		{
			// We trim off the right-side new line so that the closing </p> tag
			// will be positioned immediately following the string, matching
			// the behavior of the opening <p> tag
			$str = '<p>' . rtrim($str) . '</p>';
		}

		// Remove empty paragraphs if they are on the first line, as this
		// is a potential unintended consequence of the previous code
		return preg_replace('/<p><\/p>(.*)/', '\\1', $str, 1);
	}
Format Newlines

Converts newline characters into either <p> tags or <br />

@param  string
@return string