Chore: Improve levitate comment output (#79749)

* Test removing the icon component

* Use different component

* Replace \n with <br>

* Fix formatting

* Empty commit

* Improve formatting

* Fix breaking lines format

* Remove output

* Remove breaking change
This commit is contained in:
Esteban Beltran
2023-12-20 12:40:47 +00:00
committed by GitHub
parent ae3cb8231b
commit 234ccb886f
2 changed files with 8 additions and 10 deletions
+7 -6
View File
@@ -5,13 +5,14 @@ const data = JSON.parse(fs.readFileSync('data.json', 'utf8'));
const stripAnsi = (string) => string.replace(/\u001b\[.*?m/g, '');
const printSection = (title, items) => {
let output = `### ${title}\n\n`;
let output = `<h4>${title}</h4>`;
items.forEach((item) => {
output += `**${item.name}**\n`;
output += `<sub>${item.location}</sub>\n\n`;
output += '```' + (item.declaration ? 'typescript' : 'diff typescript') + '\n';
output += item.declaration ? item.declaration : stripAnsi(item.diff);
output += '\n```\n\n';
const language = item.declaration ? 'typescript' : 'diff';
const code = item.declaration ? item.declaration : stripAnsi(item.diff);
output += `<b>${item.name}</b><br>`;
output += `<sub>${item.location}</sub><br>`;
output += `<pre lang="${language}">${code}</pre><br>`;
});
return output;
};