Skip to content

Commit eb5ec0f

Browse files
committed
Suggest linebreak. Fix microsoft#79840
1 parent 5f8dec8 commit eb5ec0f

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/vs/base/common/htmlContent.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export class MarkdownString implements IMarkdownString {
2323

2424
appendText(value: string): MarkdownString {
2525
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
26-
this.value += value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
26+
this.value += value
27+
.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
28+
.replace('\n', '\n\n');
29+
2730
return this;
2831
}
2932

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import * as assert from 'assert';
7+
import { MarkdownString } from 'vs/base/common/htmlContent';
8+
9+
suite('markdownString', () => {
10+
11+
test('escape', () => {
12+
13+
const mds = new MarkdownString();
14+
15+
mds.appendText('# foo\n*bar*');
16+
17+
assert.equal(mds.value, '\\# foo\n\n\\*bar\\*');
18+
});
19+
});

0 commit comments

Comments
 (0)