File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments