def regression_evaluation_metrics_to_markdown_metadata(metrics):
  """Converts regression evaluation metrics to KFP Viewer markdown metadata.

  Args:
    metrics: Regression metrics object.

  Returns:
    Regression metrics formatted in markdown.
  """

  regression_markdown_template = (
      '**Evaluation Metrics:**  \n'
      '&nbsp;&nbsp;&nbsp;&nbsp;**RMSE:**            {rmse}  \n'
      '&nbsp;&nbsp;&nbsp;&nbsp;**MAE:**             {mae}  \n'
      '&nbsp;&nbsp;&nbsp;&nbsp;**R-squared:**       {rsquared}  \n')

  markdown = regression_markdown_template.format(
      rmse=round(metrics.root_mean_squared_error, 2),
      mae=round(metrics.mean_absolute_error, 2),
      rsquared=round(metrics.r_squared, 2))

  markdown_metadata = {
      'type': 'markdown',
      'storage': 'inline',
      'source': markdown
  }

  return markdown_metadata