Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#61817 new defect (bug)

wptexturize(): Hyphen may be replaced with ndash

Reported by: wildworks Owned by:
Priority: normal Milestone: Awaiting Review
Component: Formatting Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

This was originally reported as a Gutenberg issue: ​https://github.com/WordPress/gutenberg/issues/64237

A strange issue has been reported where applying a text or background color to hyphens in the content causes the characters to change size as they are replaced with en-dashes.

I tracked down the problem and found that the characters were being replaced by the wptexturize() function ​here.

When text is colored in the block editor, it is wrapped in a mark element like this:

<p>Lorem<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-accent-3-color">–</mark>ipsum</p>

So I tried adding mark to the ​$default_no_texturize_tags variable array and found that this solved the problem.

My guess is that we might need to update this variable so that all elements used in inline formatting are allowed in it.

Attachments (1)

screenshot.png​ (12.6 KB ) - added by wildworks 2 years ago.

Download all attachments as: .zip

Change History (2)

@wildworks
2 years ago

This ticket was mentioned in ​PR #7134 on ​WordPress/wordpress-develop by ​@narenin.


2 years ago
#1

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.