Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private renderRemarks(docs: spec.Docs): string[] {
const ret: string[] = [];
if (docs.remarks) {
const translated = markDownToXmlDoc(this.convertSamplesInMarkdown(docs.remarks));
ret.push(...translated.split('\n'));
ret.push('');
}
// All the "tags" need to be rendered with empyt lines between them or they'll be word wrapped.
if (docs.default) { emitDocAttribute('default', docs.default); }
if (docs.stability) { emitDocAttribute('stability', this.nameutils.capitalizeWord(docs.stability)); }
if (docs.see) { emitDocAttribute('see', docs.see); }
if (docs.subclassable) { emitDocAttribute('subclassable', ''); }
for (const [k, v] of Object.entries(docs.custom || {})) {
const extraSpace = k === 'link' ? ' ' : ''; // Extra space for '@link' to keep unit tests happy
emitDocAttribute(k, v + extraSpace);
}
// Remove leading and trailing empty lines
public emitMarkdownAsRemarks(markdown: string | undefined) {
if (!markdown) { return; }
const translated = markDownToXmlDoc(this.convertSamplesInMarkdown(markdown));
const lines = translated.split('\n');
this.code.line('/// ');
for (const line of lines) {
this.code.line(`/// ${line}`);
}
this.code.line('/// ');
}