Opened 2 months ago
Last modified 2 months ago
#61817 new defect (bug)
wptexturize(): Hyphen may be replaced with ndash
Reported by: | wildworks | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch |
Focuses: | Cc: |
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.
Trac ticket: https://core.trac.wordpress.org/ticket/61817