Skip to content

Commit 0f40782

Browse files
committed
Fix bug where api-documenter was incorrectly escaping certain special characters
1 parent 9ed9bbd commit 0f40782

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎libraries/api-documenter/src/MarkdownRenderer.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ export class MarkdownRenderer {
115115

116116
private static _getEscapedText(text: string): string {
117117
const textWithBackslashes: string = text
118-
.replace('\\', '\\\\') // first replace the escape character
119-
.replace(/[\*\#\[\]\_\|]/g, (x) => '\\' + x); // then escape any special characters
118+
.replace(/\\/g, '\\\\') // first replace the escape character
119+
.replace(/[*#[\]_|]/g, (x) => '\\' + x); // then escape any special characters
120120
return textWithBackslashes
121-
.replace('&', '&')
122-
.replace('<', '&lt;')
123-
.replace('>', '&gt;');
121+
.replace(/&/g, '&amp;')
122+
.replace(/</g, '&lt;')
123+
.replace(/>/g, '&gt;');
124124
}
125125

126126
/**

‎libraries/api-documenter/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ console.log(os.EOL + colors.bold(`api-documenter ${myPackageJson.version}` + os.
1818

1919
const docItemSet: DocItemSet = new DocItemSet();
2020

21-
const dataFolder: string = path.join(__dirname, '../files');
21+
const dataFolder: string = path.join(__dirname, '../local');
2222

2323
const inputFolder: string = path.join(dataFolder, 'input');
2424
for (const filename of fsx.readdirSync(inputFolder)) {

0 commit comments

Comments
 (0)