[wp-trac] [WordPress Trac] #34994: HTML5 elements reformatted poorly switching between Visual & Text editors

WordPress Trac noreply at wordpress.org
Sat Dec 19 19:47:27 UTC 2015


#34994: HTML5 elements reformatted poorly switching between Visual & Text editors
--------------------------+------------------------------
 Reporter:  kristarella   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration
--------------------------+------------------------------
Changes (by azaozz):

 * version:  4.4 =>
 * component:  Editor => Formatting


Comment:

 Hi @kristarella, thanks for the bug report.

 This is a bug in wpautop() (both JS and PHP versions). It doesn't deal
 well with "block" tags that can contain other blocks when there are
 paragraphs in them.

 Wpautop works by replacing two new lines with a `<p>` and one new line
 with a `<br>`. If you type any new lines just before or after the
 start/end block tags (like your example for `<details>...</details>`)
 wpautop may get "confused" and try to insert `<p>` where they don't
 belong. Then on switching back to the Text editor, there extra `<p>` are
 replaced with more line breaks.

 The section, article, and aside tags are not processed by wpautop
 specifically. That's why they remain on the same line. This behaviour
 keeps them working relatively well when switching Text => Visual => Text.
 These tags should generally be avoided in the post content as they are
 used in many themes and having them in the posts would be improper
 use/nesting in many cases.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34994#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list