mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-24 23:20:49 +08:00
feat: sanitize and clamp home article description
This commit is contained in:
@@ -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 || ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user