MWDelaney / sage-acf-wp-blocks

Composer library for generating ACF Gutenberg blocks from templates. Intended for use with Roots/Sage (http://roots.io)
348 stars 65 forks source link

Paragraph and Line Breaks are being added #32

Closed djmtype closed 4 years ago

djmtype commented 4 years ago

Empty paragraphs <p></p> and <br /> are being returned from my block template onto the page. I checked my file for gremlins, etc., to be sure there weren't any hidden characters. BTW, all of my ACF fields are just plain text and textarea (without formatting) input fields.

When using this code below with the exact indentation/spacing, I get the unwanted markup:

{{--
  Title: Price List
  Category: formatting
  Mode: auto
  PostTypes: page
  SupportsAlign: false
  SupportsMode: true
  SupportsMultiple: true
--}}

@php
$title = get_field('title');
$amount = get_field('amount');
$items = get_field('items');
@endphp

<div data-{{ $block['id'] }} class="card card-opportunity">
    <div class="card-heading card-heading-secondary">
        <h2 class="card-title card-title-meta h3">{!! $title !!}<span class="card-meta-value">{!! $amount !!}</span></h2>
    </div>
    <div class="card-body">{!! $items !!}</div>
</div>

The HTML returns as this:

<div data-block_5e14f1afc510c class="card card-opportunity">
<div class="card-heading card-heading-secondary">
<h2 class="card-title card-title-meta h3">
        Gold<br>
        <span class="card-meta-value">5,000</span><br>
        </h2>
<p></p></div>
<div class="card-body">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</div>
</div>

If I minify the HTML in my template beforehand, problem solved, but it's then completely unreadable for development!

djmtype commented 4 years ago

Same thing happens when I copy/paste the Testimonial example from this repo

djmtype commented 4 years ago

Ok, found the issue. Plugin conflict with Custom Content Shortcodes.