- Custom tooltip directive (WCAG AAA) on every button in the app - Two-column timer layout with sticky hero and recent entries sidebar - Timer font selector with 16 monospace Google Fonts and live preview - UI font selector with 15+ Google Fonts - Close-to-tray and minimize-to-tray settings - New app icons (no-glow variants), platform icon set - Mini timer pop-out window - Favorites strip with drag-reorder and inline actions - README with feature documentation - Remove tracked files that belong in gitignore
22 lines
592 B
TypeScript
22 lines
592 B
TypeScript
import { marked } from 'marked'
|
|
import DOMPurify from 'dompurify'
|
|
|
|
marked.setOptions({
|
|
breaks: true,
|
|
gfm: true,
|
|
})
|
|
|
|
export function renderMarkdown(text: string): string {
|
|
if (!text) return ''
|
|
const raw = marked.parseInline(text) as string
|
|
return DOMPurify.sanitize(raw, { ALLOWED_TAGS: ['strong', 'em', 'code', 'a', 'br'], ALLOWED_ATTR: ['href', 'target', 'rel'] })
|
|
}
|
|
|
|
export function stripMarkdown(text: string): string {
|
|
if (!text) return ''
|
|
return text
|
|
.replace(/[*_~`#]/g, '')
|
|
.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1')
|
|
.replace(/!\[([^\]]*)\]\([^)]+\)/g, '$1')
|
|
}
|