Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #56734


Ignore:
Timestamp:
10/05/2022 01:59:54 AM (19 months ago)
Author:
sabernhardt
Comment:

Thanks for the report!

Could you file this on the Gutenberg GitHub repository? https://github.com/WordPress/gutenberg/issues/new/choose

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #56734

    • Property Focuses ui administration coding-standards removed
  • Ticket #56734 – Description

    initial v1  
    11When the new Block Editor generates code, parent/child blocks add a newline between the block comment and block HTML, but none before the block comment. This makes code hard to read, and could be improved by adding two newlines before a block comment. As an example, here's some code generated by a "columns" block with a heading block inside the first column:
    22
     3{{{
    34<!-- wp:columns -->
    45<div class="wp-block-columns"><!-- wp:column {"verticalAlignment":"center","width":"60%"} -->
     
    67<h4 class="has-text-align-left">Heading</h4>
    78<!-- /wp:heading -->
     9}}}
    810
    911This would be much easier to manually manage if it looked like this:
    1012
     13{{{
    1114<!-- wp:columns -->
    1215<div class="wp-block-columns">
     
    1821<h4 class="has-text-align-left">Heading</h4>
    1922<!-- /wp:heading -->
     23}}}
    2024
    2125A quick look at a couple of pages' code suggests that successive sibling blocks do appear to add newlines before/after in a way that makes them readable. The next part of the example code above is much more readable and looks like this:
    2226
     27{{{
    2328<!-- wp:heading {"textAlign":"left","level":4} -->
    2429<h4 class="has-text-align-left">Heading</h4>
     
    3237<h4 class="has-text-align-left">Another heading</h4>
    3338<!-- /wp:heading -->
     39}}}
    3440
    3541There's a similar issue with closing tags. The end of my test page looks like this:
    3642
     43{{{
    3744<!-- /wp:image --></div>
    3845<!-- /wp:column --></div>
    3946<!-- /wp:columns -->
     47}}}
    4048
    4149It would be much more helpful if it looked like this:
    4250
     51{{{
    4352<!-- /wp:image -->
    4453
     
    4857</div>
    4958<!-- /wp:columns -->
     59}}}
    5060
    5161Is this something that can be fixed/improved upon?