mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 08:06:19 +00:00
Refine settings navigation, selective pricing sync, model deletion, and admin interactions. Consolidate unreleased migrations and keep Fast policy scoped to groups. Increase confirmed capacity-rejection feedback without changing ordinary failure recovery. Co-authored-by: Codex <noreply@openai.com>
23 lines
460 B
TypeScript
23 lines
460 B
TypeScript
import DOMPurify from 'dompurify'
|
|
import { Marked } from 'marked'
|
|
|
|
const marked = new Marked({
|
|
async: false,
|
|
breaks: false,
|
|
gfm: true,
|
|
})
|
|
|
|
export function renderMarkdown(source?: string | null) {
|
|
const value = source?.trim()
|
|
if (!value)
|
|
return ''
|
|
|
|
const html = marked
|
|
.parse(value, { async: false })
|
|
.replaceAll('<a ', '<a target="_blank" rel="noreferrer" ')
|
|
|
|
return DOMPurify.sanitize(html, {
|
|
ADD_ATTR: ['target', 'rel'],
|
|
})
|
|
}
|