Kaynağa Gözat

Merge pull request #8 from ckeditor/t/7

Add newline between headers.
Piotrek Koszuliński 9 yıl önce
ebeveyn
işleme
750629d987

+ 1 - 1
packages/ckeditor5-markdown-gfm/src/lib/to-markdown/converters.js

@@ -45,7 +45,7 @@ export default [
 				hPrefix += '#';
 			}
 
-			return hPrefix + ' ' + content;
+			return hPrefix + ' ' + content + '\n';
 		}
 	},
 	// Inline code - fixing backticks inside code blocks.

+ 28 - 0
packages/ckeditor5-markdown-gfm/tests/gfmdataprocessor/headers.js

@@ -89,5 +89,33 @@ describe( 'GFMDataProcessor', () => {
 				'# Level 1'
 			);
 		} );
+
+		it( 'should process headers placed next to each other #1', () => {
+			test(
+				'# header\n' +
+				'# header',
+
+				'<h1>header</h1><h1>header</h1>'
+			);
+		} );
+
+		it( 'should process headers placed next to each other #2', () => {
+			test(
+				'# header\n' +
+				'## header\n' +
+				'### header',
+
+				'<h1>header</h1><h2>header</h2><h3>header</h3>'
+			);
+		} );
+
+		it( 'should process headers followed by a paragraph', () => {
+			test(
+				'# header\n\n' +
+				'paragraph',
+
+				'<h1>header</h1><p>paragraph</p>'
+			);
+		} );
 	} );
 } );