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.
- I'd removed
wpautop() processing from template-part.php
- And a fix has been developed for Gutenberg. But it isn't yet in a released version; it's wasn't in 10.4.0
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
- To be able to visually check that blocks display the expected HTML
- To see both the formatted output and the original HTML for the block
- To provide a little styling to highlight paragraphs and other tags that can often appear unexpectedly and which throw off the expected styling.
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
[contents] is a shortcode from oik-block
[guts] is a shortcode from oik-blocks
[bw_wpadmin] is a shortcode from oik
- and the
oik-css/css block is from oik-css.
All of which are needed on the site for which Fizzie is targetted.
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.
wpautop()processing fromtemplate-part.phpWhile investigating a problem with the site logo image size I noticed the unexpected paragraph problem reappear in my
page-footertemplate part. There were empty paragraphs around generated shortcode content.For this particular problem I discovered a simple workaround. Change from using the
wp:shortcodeblock to the custom HTML block.wp:htmlI 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
Output Input Debuggingconfigured as below.[contents]shortcode initially.Custom template definition
input-output.html is
contents-shortcode.html template part is
where
[contents]is a shortcode from oik-block[guts]is a shortcode from oik-blocks[bw_wpadmin]is a shortcode from oikoik-css/cssblock is from oik-css.All of which are needed on the site for which Fizzie is targetted.