Change inline code color to light purple and add markdown test script
This commit is contained in:
parent
fa888a9e38
commit
5beb35dbe2
|
|
@ -8,6 +8,9 @@
|
|||
"dependencies": {
|
||||
"commander": "^13.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test:markdown": "bun src/test-markdown.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "^1.3.9"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
18
src/test-markdown.ts
Normal 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()
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user