Change inline code color to light purple and add markdown test script

This commit is contained in:
Chris Wanstrath 2026-02-20 07:47:31 -08:00
parent fa888a9e38
commit 5beb35dbe2
3 changed files with 22 additions and 1 deletions

View File

@ -8,6 +8,9 @@
"dependencies": {
"commander": "^13.1.0"
},
"scripts": {
"test:markdown": "bun src/test-markdown.ts"
},
"devDependencies": {
"@types/bun": "^1.3.9"
}

View File

@ -14,7 +14,7 @@ export function renderMarkdown(text: string): string {
// Restore code spans as light blue
result = result.replace(/\x00CODE(\d+)\x00/g, (_, i) => {
return `\x1b[94m${codeSpans[parseInt(i)]}\x1b[39m`
return `\x1b[38;5;147m${codeSpans[parseInt(i)]}\x1b[39m`
})
return result

18
src/test-markdown.ts Normal file
View File

@ -0,0 +1,18 @@
import { renderMarkdown } from "./markdown"
const lines = [
"This is **bold** text",
"This is *italic* text",
"This is `inline code` text",
"Mix of **bold**, *italic*, and `code` in one line",
"**bold with `code` inside** bold",
"No markdown here",
"Multiple **bold one** and **bold two**",
"Nested-ish: **bold and *italic* together**",
]
for (const line of lines) {
console.log(` ${line}`)
console.log(` ${renderMarkdown(line)}`)
console.log()
}