| 732 | } |
| 733 | |
| 734 | export const markdownToAnsi = function (markdown) { |
| 735 | return ( |
| 736 | markdown |
| 737 | // Headers (# Text) - make blue and bold |
| 738 | .replace(/^(#{1,6})\s+(.+)$/gm, (_, hashes, text) => { |
| 739 | return chalk.bold.blue(`${hashes} ${text}`) |
| 740 | }) |
| 741 | // Bullet points - replace with yellow bullet character |
| 742 | .replace(/^[-*]\s+(.+)$/gm, (_, text) => { |
| 743 | return `${chalk.yellow('•')} ${text}` |
| 744 | }) |
| 745 | // Bold (**text**) - make bold |
| 746 | .replace(/\*\*(.+?)\*\*/g, (_, text) => { |
| 747 | return chalk.bold(text) |
| 748 | }) |
| 749 | // Italic (*text*) - make italic (dim in terminals) |
| 750 | .replace(/\*(.+?)\*/g, (_, text) => { |
| 751 | return chalk.italic(text) |
| 752 | }) |
| 753 | ) |
| 754 | } |
| 755 | |
| 756 | export function isWindows() { |
| 757 | return os.platform() === 'win32' |