Something went wrong. Try again.
TUI for Todoist written with React+Ink.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849export function priorityColor(displayPriority: number): string | undefined { switch (displayPriority) { case 1: return 'red'; case 2: return 'yellow'; case 3: return 'blue'; default: return undefined; }}
export type ContentSegment = | {type: 'text'; text: string} | {type: 'link'; text: string; url: string};
export function parseMdLink(content: string): ContentSegment[] { const segments: ContentSegment[] = []; const linkPattern = /\[((?:\[[^\]]*\]|[^\]])+)\]\(([^)]+)\)|(https?:\/\/[^\s)]+)/g;
let lastIndex = 0; let match;
while ((match = linkPattern.exec(content)) !== null) { if (match.index > lastIndex) { segments.push({ type: 'text', text: content.slice(lastIndex, match.index), }); }
if (match[1] && match[2]) { segments.push({type: 'link', text: match[1], url: match[2]}); } else if (match[3]) { segments.push({type: 'link', text: match[3], url: match[3]}); }
lastIndex = match.index + match[0].length; }
if (lastIndex < content.length) { segments.push({type: 'text', text: content.slice(lastIndex)}); }
return segments;}