(s: any)
| 148 | |
| 149 | /** Flatten markdown to readable plain text (for compact list previews/titles). */ |
| 150 | export function stripMd(s: any): string { |
| 151 | return String(s == null ? "" : s) |
| 152 | .replace(/```[\s\S]*?```/g, " ") |
| 153 | .replace(/`([^`]+)`/g, "$1") |
| 154 | .replace(/\*\*([^*]+)\*\*/g, "$1") |
| 155 | .replace(/\*([^*]+)\*/g, "$1") |
| 156 | .replace(/^#{1,6}\s+/gm, "") |
| 157 | .replace(/^\s*>\s?/gm, "") |
| 158 | .replace(/^\s*[-*+]\s+/gm, "") |
| 159 | .replace(/\[([^\]]+)\]\([^)\s]+\)/g, "$1") |
| 160 | .replace(/\s+/g, " ") |
| 161 | .trim(); |
| 162 | } |
| 163 | |
| 164 | /** Derive a short title from a summary: first heading, else first bold run, |
| 165 | * else the first sentence/line of the flattened text. */ |
no outgoing calls
no test coverage detected