Opened 4 years ago
Closed 4 years ago
#51302 closed defect (bug) (duplicate)
Lots of newlines in REST API rendered content when using block editor
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.5.1 |
Component: | Editor | Keywords: | |
Focuses: | rest-api | Cc: |
Description
In a post created with the block editor i have the following
<!-- wp:paragraph --> <p>This is paragraph 1</p> <!-- /wp:paragraph --> <!-- wp:paragraph --> <p>This is paragraph 2</p> <!-- /wp:paragraph -->
But the REST API renders the content as
"\n<p>This is paragraph 1</p>\n\n\n\n<p>This is paragraph 2</p>\n"
There seem to be 4 newlines between the paragraphs, while there should only be one. When I make the same post in the classic editor, it comes out like this. Which looks more correct.
"<p>This is paragraph 1</p>\n<p>This is paragraph 2</p>\n"
Change History (4)
#2
@
4 years ago
Hi @joyously, after some more testing this does seem to be the case. Normal HTML-comments like <!-- this is a comment -->
don't convert to \n
but block markers are.
The difference in rendered content between the classic editor and block editor is the most problematic in this case. When there are some posts made with the classic editor and some with the block editor, the rendered output is no longer predictable.
Note: See
TracTickets for help on using
tickets.
Are the block marker comments being converted to
\n
?