prismicio-community / php-kit

Community maintained development kit for Prismic and the PHP language
https://prismic.io
Other
108 stars 82 forks source link

RichText::asText() only include newline when there are multiple blocks? #152

Closed cloakedninjas closed 1 year ago

cloakedninjas commented 6 years ago

I find myself having to strip out \n chars when getting RichText as plaintext and wonder if this could change to only join multiple blocks rather than append a newline to each?

Strip the last newline char, something like:

public static function asText($richText)
{

  ...

  return substr($result, 0, -1)
}

Or is the a reason why a newline is always appended ?