@@ -177,14 +177,32 @@ describe('createCustomMarkdownSerializer', () => {
177177 expect ( getMarkdown ( ) ) . toBe ( '- Item 1\n - Nested 1.1\n- Item 2' ) ;
178178 } ) ;
179179
180- it ( 'should place two newlines between block elements ' , ( ) => {
180+ it ( 'should use a hard break between consecutive paragraphs so Perseus renders them as <br> ' , ( ) => {
181181 const docContent = [
182182 { type : 'paragraph' , content : [ { type : 'text' , text : 'First paragraph.' } ] } ,
183183 { type : 'paragraph' , content : [ { type : 'text' , text : 'Second paragraph.' } ] } ,
184184 ] ;
185185 const mockEditor = createMockEditor ( docContent ) ;
186186 const getMarkdown = createCustomMarkdownSerializer ( mockEditor ) ;
187- expect ( getMarkdown ( ) ) . toBe ( 'First paragraph.\n\nSecond paragraph.' ) ;
187+ expect ( getMarkdown ( ) ) . toBe ( 'First paragraph. \nSecond paragraph.' ) ;
188+ } ) ;
189+
190+ it ( 'should use two newlines between a paragraph and a non-paragraph block' , ( ) => {
191+ const docContent = [
192+ { type : 'paragraph' , content : [ { type : 'text' , text : 'Intro.' } ] } ,
193+ {
194+ type : 'bulletList' ,
195+ content : [
196+ {
197+ type : 'listItem' ,
198+ content : [ { type : 'paragraph' , content : [ { type : 'text' , text : 'Item A' } ] } ] ,
199+ } ,
200+ ] ,
201+ } ,
202+ ] ;
203+ const mockEditor = createMockEditor ( docContent ) ;
204+ const getMarkdown = createCustomMarkdownSerializer ( mockEditor ) ;
205+ expect ( getMarkdown ( ) ) . toBe ( 'Intro.\n\n- Item A' ) ;
188206 } ) ;
189207 } ) ;
190208
@@ -405,7 +423,7 @@ describe('createCustomMarkdownSerializer', () => {
405423 const mockEditor = createMockEditor ( docContent ) ;
406424 const getMarkdown = createCustomMarkdownSerializer ( mockEditor ) ;
407425 expect ( getMarkdown ( ) ) . toBe (
408- '<p style="text-align: center">Centered</p>\n\ nNormal\n \n<p style="text-align: right">Right</p>' ,
426+ '<p style="text-align: center">Centered</p> \ nNormal \n<p style="text-align: right">Right</p>' ,
409427 ) ;
410428 } ) ;
411429
0 commit comments