peekmd 1.0.0 → 1.0.1

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.
Files changed (6) hide show
  1. package/README.md +127 -36
  2. package/cli.ts +7 -0
  3. package/index.ts +978 -0
  4. package/package.json +8 -11
  5. package/dist/cli.js +0 -51307
  6. package/dist/index.js +0 -51303
package/README.md CHANGED
@@ -1,86 +1,177 @@
1
1
  # peekmd
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/peekmd.svg)](https://www.npmjs.com/package/peekmd)
4
+ [![npm downloads](https://img.shields.io/npm/dm/peekmd.svg)](https://www.npmjs.com/package/peekmd)
5
+ [![GitHub release](https://img.shields.io/github/v/release/HelgeSverre/peekmd)](https://github.com/HelgeSverre/peekmd/releases)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+
3
8
  A CLI tool to preview markdown files with GitHub-style rendering in your browser.
4
9
 
5
10
  ## Features
6
11
 
7
- - GitHub-flavored markdown rendering
12
+ - GitHub Flavored Markdown (GFM) rendering
8
13
  - Syntax highlighting for code blocks
14
+ - GitHub-style alerts (`[!NOTE]`, `[!TIP]`, `[!WARNING]`, `[!IMPORTANT]`, `[!CAUTION]`)
15
+ - Task lists with checkboxes
16
+ - Anchor links on headings
17
+ - File tree sidebar
9
18
  - Opens in your default browser automatically
10
- - Self-contained binary (no runtime dependencies required)
19
+ - Auto-closes when you close the browser tab
11
20
  - Cross-platform: macOS, Linux, Windows
12
21
 
22
+ ## Requirements
23
+
24
+ **[Bun](https://bun.sh) is required** to run peekmd. Install it with:
25
+
26
+ ```bash
27
+ curl -fsSL https://bun.sh/install | bash
28
+ ```
29
+
13
30
  ## Installation
14
31
 
15
- ### From Source
32
+ ### Quick Run (no install)
33
+
34
+ ```bash
35
+ # Using bunx (recommended)
36
+ bunx peekmd README.md
37
+
38
+ # Using npx (requires Bun in PATH)
39
+ npx peekmd README.md
40
+ ```
41
+
42
+ ### Global Installation
43
+
44
+ ```bash
45
+ # Using bun (recommended)
46
+ bun install -g peekmd
47
+
48
+ # Using npm (requires Bun in PATH)
49
+ npm install -g peekmd
50
+ ```
51
+
52
+ Then run from anywhere:
53
+
54
+ ```bash
55
+ peekmd README.md
56
+ ```
57
+
58
+ ### Manual Installation (from source)
59
+
60
+ Clone the repository and choose one of the following approaches:
16
61
 
17
62
  ```bash
18
- git clone https://github.com/yourusername/peekmd.git
63
+ git clone https://github.com/HelgeSverre/peekmd.git
19
64
  cd peekmd
20
65
  bun install
21
- bun build ./index.ts --compile --outfile peekmd
22
- chmod +x peekmd
23
- ./peekmd README.md
24
66
  ```
25
67
 
26
- ### Download Pre-built Binary
68
+ #### Option A: Link for Development
69
+
70
+ This creates a symlink so you can run `peekmd` from anywhere. Requires Bun to be in your PATH.
71
+
72
+ ```bash
73
+ bun link
74
+ ```
75
+
76
+ Now you can run:
77
+
78
+ ```bash
79
+ peekmd /path/to/file.md
80
+ ```
81
+
82
+ To unlink later:
83
+
84
+ ```bash
85
+ bun unlink peekmd
86
+ ```
87
+
88
+ #### Option B: Build Standalone Binary
89
+
90
+ This creates a self-contained executable that works without Bun installed at runtime.
27
91
 
28
92
  ```bash
29
- # macOS (Apple Silicon)
30
- curl -L https://github.com/yourusername/peekmd/releases/download/v1.0.0/peekmd-macos-arm64 -o peekmd
31
- chmod +x peekmd
93
+ bun run compile
94
+ ```
32
95
 
33
- # macOS (Intel)
34
- curl -L https://github.com/yourusername/peekmd/releases/download/v1.0.0/peekmd-macos-x64 -o peekmd
35
- chmod +x peekmd
96
+ This creates a `peekmd` binary in the project directory. Move it to your PATH:
36
97
 
37
- # Linux (x64)
38
- curl -L https://github.com/yourusername/peekmd/releases/download/v1.0.0/peekmd-linux-x64 -o peekmd
39
- chmod +x peekmd
98
+ ```bash
99
+ # macOS/Linux
100
+ sudo mv peekmd /usr/local/bin/
40
101
 
41
- # Windows
42
- curl -L https://github.com/yourusername/peekmd/releases/download/v1.0.0/peekmd-windows-x64.exe -o peekmd.exe
102
+ # Or add to your local bin
103
+ mv peekmd ~/.local/bin/
43
104
  ```
44
105
 
45
106
  ## Usage
46
107
 
47
108
  ```bash
48
109
  # Preview a README file
49
- ./peekmd README.md
110
+ peekmd README.md
50
111
 
51
112
  # Preview any markdown file
52
- ./peekmd docs/guide.md
113
+ peekmd docs/guide.md
53
114
 
54
115
  # Preview with full path
55
- ./peekmd /path/to/file.md
116
+ peekmd /path/to/file.md
56
117
  ```
57
118
 
58
- ## Options
59
-
60
- No options required. Simply pass the markdown file path.
61
-
62
119
  ## Controls
63
120
 
64
121
  - Press `ESC` to close the preview
65
122
  - Close the browser tab to exit
66
123
 
67
- ## Building
124
+ ## Development
68
125
 
69
126
  ```bash
70
- # Install dependencies
71
- bun install
127
+ # Run in development mode
128
+ bun run dev
72
129
 
73
- # Build self-contained binary
74
- bun build ./index.ts --compile --outfile peekmd
130
+ # Format code
131
+ bun run format
75
132
 
76
- # Binary will be ~60MB and include all dependencies
133
+ # Build standalone binary
134
+ bun run compile
77
135
  ```
78
136
 
79
- ## Requirements
137
+ ## Why Bun?
138
+
139
+ peekmd uses Bun's built-in HTTP server (`Bun.serve()`) for its simplicity and performance. This means:
140
+
141
+ - Zero configuration HTTP server
142
+ - Native TypeScript execution
143
+ - Fast startup time
144
+ - Small package size (ships TypeScript source, no build step needed)
145
+
146
+ ## Troubleshooting
147
+
148
+ ### "bun: command not found"
149
+
150
+ Bun is not installed or not in your PATH. Install it:
151
+
152
+ ```bash
153
+ curl -fsSL https://bun.sh/install | bash
154
+ ```
155
+
156
+ Then restart your terminal or run:
157
+
158
+ ```bash
159
+ source ~/.bashrc # or ~/.zshrc
160
+ ```
161
+
162
+ ### "ReferenceError: Bun is not defined"
163
+
164
+ You're running with Node.js instead of Bun. This can happen if:
165
+ - You installed an older version of peekmd
166
+ - The shebang is incorrect
167
+
168
+ Update to the latest version:
169
+
170
+ ```bash
171
+ bun install -g peekmd@latest
172
+ ```
80
173
 
81
- - macOS, Linux, or Windows
82
- - No external dependencies (self-contained binary)
83
- - Default browser for preview
174
+ Or if running from source, make sure `cli.ts` has `#!/usr/bin/env bun` as the first line.
84
175
 
85
176
  ## License
86
177
 
package/cli.ts ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bun
2
+ import { main } from "./index.ts";
3
+
4
+ main().catch((err) => {
5
+ console.error("Error:", err);
6
+ process.exit(1);
7
+ });