diff --git a/src/vs/base/common/htmlContent.ts b/src/vs/base/common/htmlContent.ts
index ac7c8ed3a9189fda9b9572037d8606d4449cef36..fee84c57bf648f2c3a5a9abdd28f3b5423f079b1 100644
--- a/src/vs/base/common/htmlContent.ts
+++ b/src/vs/base/common/htmlContent.ts
@@ -23,7 +23,10 @@ export class MarkdownString implements IMarkdownString {
appendText(value: string): MarkdownString {
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
- this.value += value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
+ this.value += value
+ .replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
+ .replace('\n', '\n\n');
+
return this;
}
diff --git a/src/vs/base/test/common/markdownString.test.ts b/src/vs/base/test/common/markdownString.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..69d33de8f17094f7a9c017e377415cda1fa08a8c
--- /dev/null
+++ b/src/vs/base/test/common/markdownString.test.ts
@@ -0,0 +1,19 @@
+/*---------------------------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+import * as assert from 'assert';
+import { MarkdownString } from 'vs/base/common/htmlContent';
+
+suite('markdownString', () => {
+
+ test('escape', () => {
+
+ const mds = new MarkdownString();
+
+ mds.appendText('# foo\n*bar*');
+
+ assert.equal(mds.value, '\\# foo\n\n\\*bar\\*');
+ });
+});