Skip to content

Commit 7b0aaca

Browse files
committed
Changing OfficeYamlDocumenter to deal with code, bold, and italic markdown
1 parent 8b87324 commit 7b0aaca

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

apps/api-documenter/src/yaml/OfficeYamlDocumenter.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,21 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
8888

8989
if (yamlItem.summary) {
9090
yamlItem.summary = this._fixupApiSet(yamlItem.summary, yamlItem.uid);
91+
yamlItem.summary = this._fixBoldAndItalics(yamlItem.summary);
92+
yamlItem.summary = this._fixCodeTicks(yamlItem.summary);
9193
}
9294
if (yamlItem.remarks) {
9395
yamlItem.remarks = this._fixupApiSet(yamlItem.remarks, yamlItem.uid);
96+
yamlItem.remarks = this._fixBoldAndItalics(yamlItem.remarks);
97+
yamlItem.remarks = this._fixCodeTicks(yamlItem.remarks);
98+
}
99+
if (yamlItem.syntax && yamlItem.syntax.parameters) {
100+
yamlItem.syntax.parameters.forEach(part => {
101+
if (part.description) {
102+
part.description = this._fixCodeTicks(part.description);
103+
part.description = this._fixBoldAndItalics(part.description);
104+
}
105+
});
94106
}
95107
}
96108

@@ -115,4 +127,19 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
115127
return this._apiSetUrlDefault; // match not found.
116128
}
117129

118-
}
130+
private _fixBoldAndItalics(text: string): string {
131+
while (text.indexOf('\\*') >= 0) {
132+
text = text.replace('\\*', '*');
133+
}
134+
135+
return text;
136+
}
137+
138+
private _fixCodeTicks(text: string): string {
139+
while (text.indexOf('\\`') >= 0) {
140+
text = text.replace('\\`', '`');
141+
}
142+
143+
return text;
144+
}
145+
}

0 commit comments

Comments
 (0)