diff --git a/src/test-markdown.ts b/src/test-markdown.ts index c8ef41a..1ce6c1c 100644 --- a/src/test-markdown.ts +++ b/src/test-markdown.ts @@ -1,34 +1,6 @@ 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**", -] +const file = Bun.file("test/MARKDOWN.md") +const content = await file.text() -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() -} +console.log(renderMarkdown(content)) diff --git a/test/MARKDOWN.md b/test/MARKDOWN.md new file mode 100644 index 0000000..15a87fd --- /dev/null +++ b/test/MARKDOWN.md @@ -0,0 +1,116 @@ +# Test Markdown Document + +This document exercises a variety of Markdown features for testing purposes. + +## Inline Formatting + +This is **bold**, this is *italic*, and this is ***bold italic***. +Here is `inline code` and ~~strikethrough~~ text. + +## Links and Images + +- [Example Link](https://example.com) +- [Link with title](https://example.com "Example Title") +- ![Alt text for image](https://via.placeholder.com/150) + +## Lists + +### Unordered + +- Item one +- Item two + - Nested item A + - Nested item B + - Deep nested +- Item three + +### Ordered + +1. First +2. Second +3. Third + 1. Sub-item + 2. Sub-item + +### Task List + +- [x] Completed task +- [ ] Incomplete task +- [ ] Another incomplete task + +## Blockquotes + +> This is a blockquote. +> +> > This is a nested blockquote. + +## Code Blocks + +Inline: `console.log("hello")` + +Fenced with language: + +```typescript +function greet(name: string): string { + return `Hello, ${name}!`; +} +``` + +Fenced without language: + +``` +plain code block +no syntax highlighting +``` + +Indented code block: + + four spaces + makes a code block + +## Tables + +| Left | Center | Right | +|:-----|:------:|------:| +| A1 | B1 | C1 | +| A2 | B2 | C2 | +| A3 | B3 | C3 | + +## Horizontal Rules + +--- + +*** + +___ + +## HTML (inline) + +
+Click to expand + +Hidden content inside a details block. + +
+ +## Escapes and Special Characters + +\*not italic\* and \`not code\` + +Ampersand: & | Less than: < | Greater than: > + +## Footnotes + +Here is a sentence with a footnote[^1]. + +[^1]: This is the footnote content. + +## Heading Levels + +### H3 + +#### H4 + +##### H5 + +###### H6