-
Notifications
You must be signed in to change notification settings - Fork 799
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
Markdown: Leave Gutenberg content intact #10635
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 4, 2018. Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this on my personal site (which was impacted by this bug). With this PR, the text is not transformed (resulting in the paragraph breaks between blocks being left intact).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works well on my end!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmsnell suggested updating the PHP Markdown code to run on Classic Blocks when the post was a Gutenberg post.
Dennis, is there a simple API for that these days?
Even if there is, I'm happy with the solution in this PR for now. I just flagged it as "Request Changes" so we could discuss it before merging.
Let's discuss the fancier alternative in #10642.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative solution has been proposed in D20852-code. Let's consolidate on one.
The alternate solution in D20852 is to allow markdown processing but stop the transform from mangling paragraphs. I think I may prefer the simplicity and clarity of this PR. Markdown processing could break blocks in others ways, and it would be good to avoid that. |
What tests do we need to do for existing Markdown content? (That is, Markdown content that was published prior to Gutenberg/WordPress 5.0.) Edit: I mean - what should we add to the Testing instructions for this PR or whatever eventual fix? |
One other thing to note is that D20852 fixes an issue with the markdown plugin not being properly disabled when Gutenberg is enabled by a user. I'm planning to separate that fix into a separate patch and land that soon. The issue we were troubleshooting was for mixed content that results when a user:
If we fix WP.com to properly disable the markdown transform when inserting posts from Gutenberg, the above issue is resolved. But then we have another issue when editing mixed block/non-block in the classic editor: |
I'm not sure I understand but will add some comments in case they help. When an existing markdown post is edited in Gutenberg, the transformed content is loaded by Gutenberg from |
Interesting, thanks for the insight. I'm not sure if that behavior makes backward compatibility easier or harder :) I feel the most important thing is to preserve the content as viewed on the site. The behavior above seems to ensure that. I feel it's less important to preserve the content as viewed in the editor. That is, if we Gutenbergify the for-edit-content, as long as it's "semantically" the same even though it's been syntactically changed is maybe OK? But basically, I want us to be sure to test these scenarios (like the complicated one you outlined above) :) |
Thanks for the alternate solution! I agree we'll need thorough testing in order to decide which solution works best and has as little negative impact as possible, on both old and new content. Perhaps @Automattic/flowpatrol could help with this? |
I'll merge this for now, while leaving #10642 open so we can discuss and implement a fancier alternative in the future. |
Discussing alternatives in a new issue
This PR updates the Markdown module to leave any Gutenberg content untouched, in order to not mess up the block markup validation and parsing. Fixes #10634 #### Changes proposed in this Pull Request: * Update the Markdown module to leave untouched any content that contains Gutenberg blocks. #### Testing instructions: * Make sure you have the latest WordPress 5.0 beta. * Checkout this branch. * Make sure your site is connected. * Make sure Markdown is enabled. * Write a Gutenberg post with various blocks. * After saving and refreshing, verify there are no validation errors. * Try the Markdown block. * Verify it works well with various content. * Install and activate the Classic Editor plugin. * Write a post in the classic editor and verify Markdown still works well there. #### Proposed changelog entry for your changes: * Make Markdown module compatible with the Gutenberg editor in WordPress 5.0.
Cherry-picked to |
This PR updates the Markdown module to leave any Gutenberg content untouched, in order to not mess up the block markup validation and parsing.
Fixes #10634
Changes proposed in this Pull Request:
Testing instructions:
Proposed changelog entry for your changes: