bobbingwide / fizzie

Fizzie theme - a Full Site Editing theme using Gutenberg blocks
9 stars 1 forks source link

Create an Output Input Debugging custom template to aid debugging #65

Closed bobbingwide closed 1 year ago

bobbingwide commented 3 years ago

In the UK Community Slack #gutenberg channel Dan Atrill reported a problem with unwanted paragraphs. I thought I'd already resolved this problem as reported in #20.

While investigating a problem with the site logo image size I noticed the unexpected paragraph problem reappear in my page-footer template part. There were empty paragraphs around generated shortcode content. For this particular problem I discovered a simple workaround. Change from using the wp:shortcode block to the custom HTML block. wp:html

I achieved this without having to look deeply into the code. Instead I developed a custom template that displays the minimum output to debug the generated HTML.

This issue is to formally document the requirements for a custom template to help debug blocks in the front end.

Requirements

Proposed solution

Custom template definition

{
      "name": "output-input",
      "title": "Output Input Debugging",
      "postTypes": [
        "page",
        "post",
        "block",
        "block_example"
      ]
    }

input-output.html is

<!-- wp:post-title /-->
<!-- wp:post-content /-->
<!-- wp:template-part {"slug":"contents-shortcode","theme":"fizzie"} /-->

contents-shortcode.html template part is

[contents]
[guts]
[bw_wpadmin]

<!-- wp:oik-css/css {"css":"p { border: 1px solid red; }\nbr { background: #eee; padding: 0px; content: \u0022A\u0022 !important;\n    display: block !important; border: 1px red dotted;}    ","text":"Problems? "} /-->

where

All of which are needed on the site for which Fizzie is targetted.

bobbingwide commented 3 years ago

Here's an example where I put shortcode blocks into columns, discovered the unwanted paragraphs then added the equivalent using custom HTML blocks. Also there's a custom HTML block with hand crafted <br /> tags between A, B and C

image

bobbingwide commented 3 years ago

Here are two screen captures attempting to debug the columns blocks problem. In the first capture wpautop() IS being run. In the second it's NOT. You can see one red block disappear, just above the "Blocks" widget title. The rest of the output seems reasonable to me given the HTML input.

image

image

bobbingwide commented 1 year ago

delivered in v0.5.0