This commit is contained in:
Johannes Rieken
2017-08-23 16:16:57 +02:00
parent 39c26ad454
commit 60892e5fa8
2 changed files with 5 additions and 13 deletions

View File

@@ -33,15 +33,11 @@ export class MarkdownString implements IMarkdownString {
}
appendText(value: string): this {
this.value += textToMarkedString(value);
// escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
this.value += value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&');
return this;
}
// appendMarkdown(value: string): this {
// this.value += value;
// return this;
// }
appendCodeblock(langId: string, code: string): this {
this.value += '```';
this.value += langId;
@@ -76,10 +72,6 @@ function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {
}
}
export function textToMarkedString(text: string): string {
return text.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
}
export function removeMarkdownEscapes(text: string): string {
if (!text) {
return text;