/**
* Returns a Content object with pre-save transformations applied.
- * This implementation just trims trailing whitespace.
+ * This implementation just trims trailing whitespace and normalizes newlines.
*
* @param Title $title
* @param User $user
public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
$text = $this->getNativeData();
$pst = rtrim( $text );
+ $pst = str_replace( [ "\r\n", "\r" ], "\n", $pst );
return ( $text === $pst ) ? $this : new static( $pst, $this->getModel() );
}