WordPress.org

Making WordPress.org

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#1250 closed defect (fixed)

DevHub: The RegEx in fix_unintended_markdown() filter is catching post content

Reported by: DrewAPicture Owned by: drewapicture
Milestone: Priority: normal
Component: Developer Hub Keywords: has-patch
Cc:

Description

In [1138], we introduced the fix_unintended_markdown() filter on the_content which was meant to cover the case where Parsedown was parsing parameters like $post__in as having italics in the middle.

Unfortunately, we're also now seeing emphasis tags in other places, e.g. Explanations, also getting re-replaced with underscores.

Attachments (2)

1250.diff (541 bytes) - added by DrewAPicture 4 years ago.
1250.2.diff (672 bytes) - added by DrewAPicture 4 years ago.

Download all attachments as: .zip

Change History (5)

@DrewAPicture
4 years ago

@DrewAPicture
4 years ago

#1 @DrewAPicture
4 years ago

  • Summary changed from DevHub: The RegEx in fix_unintended_markdown() filter is too greedy to DevHub: The RegEx in fix_unintended_markdown() filter is catching post content

#2 @drewapicture
4 years ago

  • Owner set to drewapicture
  • Resolution set to fixed
  • Status changed from new to closed

In 1914:

DevHub: Adjust the conditions in fix_unintended_markdown() to skip content where paragraph tags are present.

We can skip content containing paragraph tags because we know they won't be used within parameters or parameter descriptions, nor will they be used in outputting parameters, which are handled as definition term elements.

The original intended use-case of the function is still satisfied.

Fixes #1250.

#3 @coffee2code
3 years ago

In 3796:

developer.wordpress.org: Use a better approach to preventing fix_unintended_markdown() from running against explanations.

  • Revert [1914].
  • In get_explanation_field(), don't run value through 'the_content' filter. It's not applicable for all fields. And post_content is already passed through the filter in the template prior to display (thus this also prevents double-filtering).
  • Temporarily unhook fix_unintended_markdown() from 'the_content' filter when outputting the explanation content.
  • Hook 'the_content' for fix_unintended_markdown() at a priority of 1. Also, it's a filter, not an action.

See #1250.

Note: See TracTickets for help on using tickets.