Automattic\WooCommerce\EmailEditor\Engine\Renderer

Html2Text::render_textprivate staticWC 1.0

Replace any special characters with simple text versions

This prevents output issues:

  • Convert non-breaking spaces to regular spaces; and
  • Convert zero-width non-joiners to '' (nothing).

This is to match our goal of rendering documents as they would be rendered by a browser.

Method of the class: Html2Text{}

No Hooks.

Returns

String. The processed text.

Usage

$result = Html2Text::render_text( $text ): string;
$text(string) (required)
The text to process.

Html2Text::render_text() code WC 10.7.0

private static function render_text( string $text ): string {
	$text = str_replace( self::nbsp_codes(), ' ', $text );
	$text = str_replace( self::zwnj_codes(), '', $text );
	return $text;
}