feat: sanitize and clamp home article description

This commit is contained in:
Tim
2025-07-04 16:11:07 +08:00
parent 48273887da
commit 134bbb4d76
2 changed files with 16 additions and 2 deletions

View File

@@ -9,3 +9,10 @@ const md = new MarkdownIt({
export function renderMarkdown(text) {
return md.render(text || '')
}
export function stripMarkdown(text) {
const html = md.render(text || '')
const el = document.createElement('div')
el.innerHTML = html
return el.textContent || el.innerText || ''
}