MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / markdownToAnsi

Function markdownToAnsi

lib/utils.js:734–754  ·  view source on GitHub ↗
(markdown)

Source from the content-addressed store, hash-verified

732}
733
734export 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
756export function isWindows() {
757 return os.platform() === 'win32'

Callers 1

formatResponseFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected