markdownly.js
v1.4.0
Published
Render Markdown to Terminal - Zero Dependencies
Maintainers
Readme
markdownly.js
Render Markdown to Terminal — Zero Dependencies
About
Fast and lightweight Markdown renderer for the terminal. Built with Bun/TypeScript, zero external dependencies.
Supports:
- Headers (h1-h6)
- Bold, italic, strikethrough
- Code blocks with syntax highlighting
- Inline code
- Blockquotes
- GitHub-style alerts (NOTE, TIP, WARNING, etc.)
- Tables
- Lists (ordered, unordered, checkboxes)
- Links and images
- Horizontal rules
Fast Start
# bun
bun add markdownly.js
# npm
npm install markdownly.jsCLI Usage
# render file
md README.md
# pipe from stdin
cat README.md | md
# or use full name
markdown docs/guide.mdAPI Usage
import { markdown } from "markdownly.js"
const output = markdown(`
# Hello World
This is **bold** and *italic* text.
\`\`\`js
const x = 42
console.log(x)
\`\`\`
`)
console.log(output)Functions
markdown(input: string): string
Main function. Parses markdown and returns ANSI-styled string for terminal output.
import { markdown } from "markdownly.js"
console.log(markdown("# Title"))parse(input: string): Token[]
Low-level parser. Returns array of tokens.
import { parse } from "markdownly.js"
const tokens = parse("# Hello")
// [{ type: 'h1', content: 'Hello', children: [...] }]render(tokens: Token[]): string
Low-level renderer. Converts tokens to ANSI string.
import { parse, render } from "markdownly.js"
const tokens = parse("**bold**")
const output = render(tokens)Supported Syntax
Headers
# H1
## H2
### H3
#### H4
##### H5
###### H6Text Formatting
**bold**
*italic*
~~strikethrough~~
`inline code`
==marked==
++inserted++Code Blocks
```js
const x = 42
```Supported languages: JavaScript, TypeScript, Go, Python, Bash, HTML, CSS, JSON, YAML
Lists
- Item 1
- Item 2
- Nested
1. First
2. Second
- [ ] Todo
- [x] DoneBlockquotes
> Quote text
> More textAlerts (GitHub style)
> [!NOTE]
> Information
> [!TIP]
> Helpful tip
> [!WARNING]
> Be careful
> [!IMPORTANT]
> Critical info
> [!CAUTION]
> Danger zoneTables
| Name | Value |
|------|-------|
| foo | 42 |
| bar | 13 |Links & Images
[Link text](https://example.com)
Development
# clone
git clone https://github.com/zarazaex69/markdownly.js.git
cd markdownly.js
# run
bun run src/cli.ts example/index.md
# build
bun run buildContact
Telegram: zarazaex Email: [email protected] Site: zarazaex.xyz
