Merge branch 'test-markdown'
This commit is contained in:
commit
3c1f42e985
|
|
@ -1,34 +1,6 @@
|
||||||
import { renderMarkdown } from "./markdown"
|
import { renderMarkdown } from "./markdown"
|
||||||
|
|
||||||
const lines = [
|
const file = Bun.file("test/MARKDOWN.md")
|
||||||
"This is **bold** text",
|
const content = await file.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(renderMarkdown(content))
|
||||||
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()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
116
test/MARKDOWN.md
Normal file
116
test/MARKDOWN.md
Normal file
|
|
@ -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")
|
||||||
|
- 
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Click to expand</summary>
|
||||||
|
|
||||||
|
Hidden content inside a details block.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 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
|
||||||
Loading…
Reference in New Issue
Block a user