sandlot/src/test-markdown.ts

35 lines
834 B
TypeScript

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()
}
// Code fence tests
console.log("--- Code fence tests ---")
const fenceTests = [
"Here is some code:\n```typescript\nconst x = 1\n```\nDone.",
"```\nhello\n```",
"```js\nconsole.log('hi')\n```",
]
for (const test of fenceTests) {
console.log("INPUT:")
console.log(test)
console.log("OUTPUT:")
console.log(renderMarkdown(test))
console.log()
}