浏览代码

Fixed newline adding after header conversion from view to markdown.

Szymon Kupś 9 年之前
父节点
当前提交
027f4bd29a

+ 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.

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

@@ -89,5 +89,24 @@ 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>'
+			);
+		} );
 	} );
 } );