capsule-ai-cli
Version:
The AI Model Orchestrator - Intelligent multi-model workflows with device-locked licensing
37 lines • 1.29 kB
JavaScript
import React from 'react';
import { Box, Text } from 'ink';
import { marked } from 'marked';
import TerminalRenderer from 'marked-terminal';
import chalk from 'chalk';
import terminalSize from 'terminal-size';
marked.setOptions({
gfm: true,
breaks: true,
renderer: new TerminalRenderer({
showSectionPrefix: false,
width: terminalSize().columns - 5,
reflowText: true,
tab: 2,
unescape: true,
code: chalk.yellow,
blockquote: chalk.gray.italic,
html: chalk.gray,
heading: chalk.bold.underline,
firstHeading: chalk.bold.underline,
strong: chalk.bold,
em: chalk.italic,
del: chalk.strikethrough,
link: chalk.blue.underline,
href: chalk.blue.underline,
listitem: (text) => {
const cleanText = text.trim().replace(/^\*\s*/, '');
return ` • ${cleanText}`;
}
})
});
export const MarkdownRenderer = ({ content }) => {
const rendered = marked.parse(content, { async: false });
const lines = rendered.split('\n');
return (React.createElement(Box, { flexDirection: "column" }, lines.map((line, index) => (React.createElement(Text, { key: index }, line || ' ')))));
};
//# sourceMappingURL=markdown-renderer.js.map