refac: markdown rendering

Co-Authored-By: Jun Siang Cheah <me@jscheah.me>
This commit is contained in:
Timothy J. Baek
2024-08-05 17:47:18 +02:00
parent 6e6f9862e6
commit ab6346ea1c
6 changed files with 173 additions and 107 deletions

View File

@@ -90,6 +90,11 @@ export const revertSanitizedResponseContent = (content: string) => {
return content.replaceAll('&lt;', '<').replaceAll('&gt;', '>');
};
export function unescapeHtml(html: string) {
const doc = new DOMParser().parseFromString(html, 'text/html');
return doc.documentElement.textContent;
}
export const capitalizeFirstLetter = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
};