markdownly.js 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +219 -0
- package/dist/cli.js +741 -0
- package/dist/index.js +720 -0
- package/package.json +51 -0
- package/readme.md +219 -0
package/README.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
# markdownly.js
|
|
8
|
+
|
|
9
|
+
Render Markdown to Terminal — Zero Dependencies
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## About
|
|
14
|
+
|
|
15
|
+
Fast and lightweight Markdown renderer for the terminal. Built with Bun/TypeScript, zero external dependencies.
|
|
16
|
+
|
|
17
|
+
Supports:
|
|
18
|
+
- Headers (h1-h6)
|
|
19
|
+
- Bold, italic, strikethrough
|
|
20
|
+
- Code blocks with syntax highlighting
|
|
21
|
+
- Inline code
|
|
22
|
+
- Blockquotes
|
|
23
|
+
- GitHub-style alerts (NOTE, TIP, WARNING, etc.)
|
|
24
|
+
- Tables
|
|
25
|
+
- Lists (ordered, unordered, checkboxes)
|
|
26
|
+
- Links and images
|
|
27
|
+
- Horizontal rules
|
|
28
|
+
|
|
29
|
+
## Fast Start
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# bun
|
|
33
|
+
bun add markdownly.js
|
|
34
|
+
|
|
35
|
+
# npm
|
|
36
|
+
npm install markdownly.js
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## CLI Usage
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# render file
|
|
43
|
+
md README.md
|
|
44
|
+
|
|
45
|
+
# pipe from stdin
|
|
46
|
+
cat README.md | md
|
|
47
|
+
|
|
48
|
+
# or use full name
|
|
49
|
+
markdown docs/guide.md
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## API Usage
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { markdown } from "markdownly.js"
|
|
56
|
+
|
|
57
|
+
const output = markdown(`
|
|
58
|
+
# Hello World
|
|
59
|
+
|
|
60
|
+
This is **bold** and *italic* text.
|
|
61
|
+
|
|
62
|
+
\`\`\`js
|
|
63
|
+
const x = 42
|
|
64
|
+
console.log(x)
|
|
65
|
+
\`\`\`
|
|
66
|
+
`)
|
|
67
|
+
|
|
68
|
+
console.log(output)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Functions
|
|
72
|
+
|
|
73
|
+
#### `markdown(input: string): string`
|
|
74
|
+
|
|
75
|
+
Main function. Parses markdown and returns ANSI-styled string for terminal output.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { markdown } from "markdownly.js"
|
|
79
|
+
|
|
80
|
+
console.log(markdown("# Title"))
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### `parse(input: string): Token[]`
|
|
84
|
+
|
|
85
|
+
Low-level parser. Returns array of tokens.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { parse } from "markdownly.js"
|
|
89
|
+
|
|
90
|
+
const tokens = parse("# Hello")
|
|
91
|
+
// [{ type: 'h1', content: 'Hello', children: [...] }]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### `render(tokens: Token[]): string`
|
|
95
|
+
|
|
96
|
+
Low-level renderer. Converts tokens to ANSI string.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { parse, render } from "markdownly.js"
|
|
100
|
+
|
|
101
|
+
const tokens = parse("**bold**")
|
|
102
|
+
const output = render(tokens)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Supported Syntax
|
|
106
|
+
|
|
107
|
+
### Headers
|
|
108
|
+
|
|
109
|
+
```markdown
|
|
110
|
+
# H1
|
|
111
|
+
## H2
|
|
112
|
+
### H3
|
|
113
|
+
#### H4
|
|
114
|
+
##### H5
|
|
115
|
+
###### H6
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Text Formatting
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
**bold**
|
|
122
|
+
*italic*
|
|
123
|
+
~~strikethrough~~
|
|
124
|
+
`inline code`
|
|
125
|
+
==marked==
|
|
126
|
+
++inserted++
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Code Blocks
|
|
130
|
+
|
|
131
|
+
````markdown
|
|
132
|
+
```js
|
|
133
|
+
const x = 42
|
|
134
|
+
```
|
|
135
|
+
````
|
|
136
|
+
|
|
137
|
+
Supported languages: JavaScript, TypeScript, Go, Python, Bash, HTML, CSS, JSON, YAML
|
|
138
|
+
|
|
139
|
+
### Lists
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
- Item 1
|
|
143
|
+
- Item 2
|
|
144
|
+
- Nested
|
|
145
|
+
|
|
146
|
+
1. First
|
|
147
|
+
2. Second
|
|
148
|
+
|
|
149
|
+
- [ ] Todo
|
|
150
|
+
- [x] Done
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Blockquotes
|
|
154
|
+
|
|
155
|
+
```markdown
|
|
156
|
+
> Quote text
|
|
157
|
+
> More text
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Alerts (GitHub style)
|
|
161
|
+
|
|
162
|
+
```markdown
|
|
163
|
+
> [!NOTE]
|
|
164
|
+
> Information
|
|
165
|
+
|
|
166
|
+
> [!TIP]
|
|
167
|
+
> Helpful tip
|
|
168
|
+
|
|
169
|
+
> [!WARNING]
|
|
170
|
+
> Be careful
|
|
171
|
+
|
|
172
|
+
> [!IMPORTANT]
|
|
173
|
+
> Critical info
|
|
174
|
+
|
|
175
|
+
> [!CAUTION]
|
|
176
|
+
> Danger zone
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Tables
|
|
180
|
+
|
|
181
|
+
```markdown
|
|
182
|
+
| Name | Value |
|
|
183
|
+
|------|-------|
|
|
184
|
+
| foo | 42 |
|
|
185
|
+
| bar | 13 |
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Links & Images
|
|
189
|
+
|
|
190
|
+
```markdown
|
|
191
|
+
[Link text](https://example.com)
|
|
192
|
+

|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# clone
|
|
199
|
+
git clone https://github.com/zarazaex69/markdownly.js.git
|
|
200
|
+
cd markdownly.js
|
|
201
|
+
|
|
202
|
+
# run
|
|
203
|
+
bun run src/cli.ts example/index.md
|
|
204
|
+
|
|
205
|
+
# build
|
|
206
|
+
bun run build
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
<div align="center">
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### Contact
|
|
214
|
+
|
|
215
|
+
Telegram: [zarazaex](https://t.me/zarazaexe)<br>
|
|
216
|
+
Email: [zarazaex@tuta.io](mailto:zarazaex@tuta.io)<br>
|
|
217
|
+
Site: [zarazaex.xyz](https://zarazaex.xyz)
|
|
218
|
+
|
|
219
|
+
</div>
|