Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paragraph tags are stripped #3922

Closed
oandregal opened this issue Dec 11, 2017 · 19 comments
Closed

Paragraph tags are stripped #3922

oandregal opened this issue Dec 11, 2017 · 19 comments
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.
Milestone

Comments

@oandregal
Copy link
Member

oandregal commented Dec 11, 2017

A gif is worth a thousand words:

reusable-block-paragraph

Steps to repro:

  • I created a reusable block to insert breadcrumbs on certain pages - a paragraph that contains a link and some other text.
  • I reused that block in a page. The markup seemed to be correct in the editor.
  • When I publish the page, the reusable block doesn't contain the paragraph markup.
@oandregal oandregal added [Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended labels Dec 11, 2017
@oandregal
Copy link
Member Author

cc @noisysocks because I saw you did some work recently on reusable blocks.

@oandregal
Copy link
Member Author

When I go back to the page to edit this I got this message:

editing-after

And in the console:

editing-after-errors

@aduth
Copy link
Member

aduth commented Dec 12, 2017

I'm having trouble reproducing this. Do you have other plugins active on your site? Wondering if one of them may be clobbering the markup when the post is saved.

(Aside: The validation message looks backwards, should say "expected tag name p" I would think)

@oandregal
Copy link
Member Author

I have 11 active plugins on my site (which is part of a WordPress network I manage):

  • These are active at a network level: Akismet anti-spam, Blogger Importer, Categories to Tags Converter Importer, Force Strong Passwords, Jetpack by WordPress.com, Network Plugin Auditor, VaultPress, WordPress Importer.
  • These are active on my site: Gutenberg, Official StatCounter Plugin, RSS Importer.

@oandregal
Copy link
Member Author

oandregal commented Dec 13, 2017

I've got another way to reproduce this error, so perhaps it hasn't anything to do with ReusableBlocks. Here's the gif:

no-paragraphs

Steps:

  • open an old published post that contains images and consecutive paragraphs
  • convert to blocks
  • publish

When I got back to the editor, the paragraph blocks cannot be processed by Gutenberg:

no-paragraphs-editor-back

And this is what the console shows at that point:

no-paragraphs-console-back

The HTML that's saved looks like this (it contains the paragraph tags and some weird void paragraphs as well):


<!-- wp:core/paragraph -->
<p><em>» <a href="http://nosolosoftware.com/glossary/">Glossary</a> » Canonical model</em></p>
<!-- /wp:core/paragraph -->
<p>&nbsp;</p>
<!-- wp:core/paragraph -->
<p>It's known as the <a href="http://www.eaipatterns.com/CanonicalDataModel.html">canonical model</a> the model that contains the minimum number of elements required to communicate among programs or different parts of the same application:</p>
<!-- /wp:core/paragraph -->
<p>&nbsp;</p>
<!-- wp:core/image -->
<figure class="wp-block-image"><img src="http://nosolosoftware.com/files/2015/03/CanonicalDataModel.gif" alt="" /></figure>
<!-- /wp:core/image -->
<p>&nbsp;</p>
<!-- wp:core/paragraph -->
<p>Within Domain Driven Design there is a certain hesitance to use <a href="https://www.innoq.com/en/blog/thoughts-on-a-canonical-data-model/">a single canonical model for intercommunication</a>, leaning towards using microformats or <a href="http://martinfowler.com/bliki/MultipleCanonicalModels.html">multiple canonical models</a> depending on the <a href="http://martinfowler.com/bliki/BoundedContext.html">application context</a>:</p>
<!-- /wp:core/paragraph -->
<p>&nbsp;</p>
<!-- wp:core/image -->
<figure class="wp-block-image"><img src="http://nosolosoftware.com/files/2015/03/bounded_context.png" alt="" /></figure>
<!-- /wp:core/image -->

@oandregal oandregal changed the title Reusable blocks renders no paragraph node Paragraph tags are stripped Dec 13, 2017
@oandregal
Copy link
Member Author

I've tried deactivating Official StatCounter Plugin and RSS Importer and disconnecting Jetpack from my site as well. I've got the same result. Any other test I may do to help?

@aduth
Copy link
Member

aduth commented Dec 13, 2017

@nosolosw Can you try deactivating the Jetpack plugin instead of just disconnecting from WordPress.com?

@oandregal
Copy link
Member Author

Yup, I did that as well (deactivating it at the network level) but got the same result.

@oandregal
Copy link
Member Author

Confirmed that I can reproduce this in Gutenberg 2.0.

@karmatosed karmatosed added this to the Merge Proposal milestone Jan 25, 2018
@withinboredom
Copy link

I also had this same problem, however my layout was a bit different:

<!-- wp:core/paragraph {"dropCap":true} -->
<p class="has-drop-cap">First Paragraph.</p>
<!-- /wp:core/paragraph -->

<!-- wp:core/paragraph -->

Second paragraph.

<!-- /wp:core/paragraph -->

All following paragraph blocks are missing <p> tags and were typed in the visual editor normally as writing a book. At the end, I added the drop cap to the first paragraph after editing the text in the block. Everything looked fine in the editor, however when I published, it was a massive block of text except for the first paragraph.

@withinboredom
Copy link

I should also add that I also had Jetpack connected, but disabling gutenberg resolved the problem.

@withinboredom
Copy link

I wonder if it has something to do with wpautop

@oandregal
Copy link
Member Author

I can confirm that after @aduth #4874 I can only repro this with these steps if I have the Jetpack's "write post/pages in markdown" option enabled when I convert an old post to Gutenblocks.

Perhaps this is worth labeling Plugin / Extension conflict?

@Ipstenu
Copy link
Contributor

Ipstenu commented Feb 27, 2018

Well... that’s a pretty big conflict. I had to disable Gutenberg just to get content written in Gutenberg to show correct. The only other option was manually editing OUT the Gutenberg html comments in html edit mode.

@aduth
Copy link
Member

aduth commented Feb 27, 2018

@aduth aduth added the [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes. label Feb 27, 2018
@aduth
Copy link
Member

aduth commented Feb 27, 2018

Since Jetpack's Markdown module strips paragraphs prior to save, merely deactivating the Markdown module will not retroactively fix broken posts. However, since Gutenberg is capable of "repairing" unwrapped paragraphs, it should† be resolved if opening the post once more and saving it within Gutenberg.

In trying this myself, this works as expected, with one exception being that link tags (and I assume may apply to bold, italic, etc) showed the HTML as escaped and needed to be updated before saving. Unsure yet if this is also a conflict introduced with Jetpack's Markdown module.

@mkaz
Copy link
Member

mkaz commented Mar 3, 2018

@nosolosw @Ipstenu The Jetpack Markdown and Gutenberg conflict should be resolved in 2.3.0 which was deployed yesterday.

Fixed in this PR: #5288

@oandregal
Copy link
Member Author

With Gutenberg 2.3.0 and Jetpack 5.8 it is no longer an issue (tested following this steps). 🎉

@aduth
Copy link
Member

aduth commented Mar 5, 2018

Great! Going to consider this closed unless the issue crops up again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.
Projects
None yet
Development

No branches or pull requests

6 participants