attnmd 0.1.0 → 0.1.15
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/LICENSE +21 -0
- package/README.md +133 -0
- package/package.json +1 -1
- package/scripts/postinstall.mjs +1 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 James Lal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">attn</h1>
|
|
3
|
+
<p align="center">
|
|
4
|
+
A markdown viewer for people who live in the terminal.<br>
|
|
5
|
+
One command. Native window. No Electron.
|
|
6
|
+
</p>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="#install">Install</a> ·
|
|
11
|
+
<a href="https://github.com/lightsofapollo/attn/issues">Issues</a> ·
|
|
12
|
+
<a href="#contributing">Contributing</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="assets/hero.png" alt="attn showing markdown with checkboxes, code, and a file tree" width="720">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
attn .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
That's it. A native window opens with your project's markdown rendered beautifully — with live reload, a file tree, tabs, and a built-in editor. No config, no browser, no 200MB runtime.
|
|
26
|
+
|
|
27
|
+
## Why attn?
|
|
28
|
+
|
|
29
|
+
Most markdown previewers are either browser tabs you have to manually refresh, or Electron apps that eat your RAM for breakfast.
|
|
30
|
+
|
|
31
|
+
attn is a **single ~8MB binary**. It forks to background as a daemon, opens a native macOS window, and watches your files. Edit in Vim, VS Code, whatever — attn reloads instantly. Open another file? It joins the same window as a tab.
|
|
32
|
+
|
|
33
|
+
**What you get:**
|
|
34
|
+
|
|
35
|
+
- **Live reload** — save a file, see the change. No refresh button.
|
|
36
|
+
- **Interactive checkboxes** — click a `- [ ]` task and it writes back to the file.
|
|
37
|
+
- **Built-in editor** — hit `Cmd+E` to toggle a full ProseMirror editor with syntax highlighting, math, and mermaid diagrams.
|
|
38
|
+
- **File tree + fuzzy search** — browse your project with `Cmd+P`. Lazy-loads folders so it's fast on huge repos.
|
|
39
|
+
- **Tabs + projects** — open multiple files, switch between projects with `Cmd+;`. attn remembers your workspaces.
|
|
40
|
+
- **Mermaid diagrams** — flowcharts, sequence diagrams, and more render inline from fenced code blocks.
|
|
41
|
+
- **Media support** — images (with zoom/pan), video, and audio play natively.
|
|
42
|
+
- **Paper & ink themes** — warm parchment light theme by default, cool dark theme with `--dark`.
|
|
43
|
+
- **Single instance** — run `attn` from ten terminals. One daemon, one window, new tab each time.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
### Primary: crates.io
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cargo install attn
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Alternative: npm package (testing path)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx attnmd
|
|
57
|
+
# or
|
|
58
|
+
npm install -g attnmd && attn
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### From source
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/lightsofapollo/attn.git
|
|
65
|
+
cd attn && cargo install --path .
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Requires Rust 1.85+.
|
|
69
|
+
For npm installs, Node 18+ is required.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
attn # open current directory
|
|
75
|
+
attn README.md # open a file
|
|
76
|
+
attn ~/projects/myapp # open a project
|
|
77
|
+
attn --dark # force dark mode
|
|
78
|
+
attn --status todo.md # print task progress: "3/5 tasks complete"
|
|
79
|
+
attn --json spec.md # dump document structure as JSON
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Keyboard shortcuts
|
|
83
|
+
|
|
84
|
+
| Shortcut | Action |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `Cmd+P` | Fuzzy file search |
|
|
87
|
+
| `Cmd+E` | Toggle editor |
|
|
88
|
+
| `Cmd+F` | Find & replace |
|
|
89
|
+
| `Cmd+;` | Switch project |
|
|
90
|
+
| `Cmd+W` | Close tab |
|
|
91
|
+
| `Cmd+Tab` / `Cmd+Shift+Tab` | Navigate tabs |
|
|
92
|
+
| `Cmd+=` / `Cmd+-` | Zoom in / out |
|
|
93
|
+
| `Cmd+0` | Reset zoom |
|
|
94
|
+
| `Cmd+/` | Show all shortcuts |
|
|
95
|
+
|
|
96
|
+
## How it works
|
|
97
|
+
|
|
98
|
+
The Svelte 5 frontend is compiled by Vite and **embedded into the Rust binary** at build time. No bundled web server, no extracted assets — it's a single self-contained executable.
|
|
99
|
+
|
|
100
|
+
First launch forks a daemon to the background. The daemon opens a native window via [wry](https://github.com/tauri-apps/wry) (the same webview engine behind Tauri) and listens on a Unix socket. Subsequent `attn` calls connect to the socket and open new tabs in the existing window. If the binary changes (you rebuild), the old daemon is automatically replaced.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
src/
|
|
104
|
+
main.rs CLI, native window, keyboard shortcuts
|
|
105
|
+
daemon.rs Unix socket IPC, single-instance daemon
|
|
106
|
+
watcher.rs File system monitoring with debouncing
|
|
107
|
+
markdown.rs Structure extraction (tasks, phases, file refs)
|
|
108
|
+
ipc.rs Webview ↔ Rust messaging
|
|
109
|
+
files.rs File tree, media type detection
|
|
110
|
+
projects.rs Project registry
|
|
111
|
+
|
|
112
|
+
web/src/ Svelte 5 frontend
|
|
113
|
+
web/styles/ Tailwind CSS
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Contributing
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
task dev # Vite HMR + Rust in foreground
|
|
120
|
+
task dev ATTN_PATH=path/to/file.md # Open a specific file
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The `task dev` command starts Vite for hot module replacement and runs the Rust binary in foreground mode, pointed at the Vite dev server.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
scripts/build.sh # Debug build
|
|
127
|
+
scripts/build.sh release # Release build
|
|
128
|
+
scripts/build.sh prod # Production build
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -20,7 +20,7 @@ const assetSuffix = resolveAssetSuffix(process.platform, process.arch);
|
|
|
20
20
|
if (!assetSuffix) {
|
|
21
21
|
console.warn(
|
|
22
22
|
`attn: unsupported platform ${process.platform}/${process.arch}. ` +
|
|
23
|
-
"Currently supported: darwin-arm64
|
|
23
|
+
"Currently supported: darwin-arm64."
|
|
24
24
|
);
|
|
25
25
|
process.exit(0);
|
|
26
26
|
}
|
|
@@ -47,9 +47,6 @@ function resolveAssetSuffix(platform, arch) {
|
|
|
47
47
|
if (platform === "darwin" && arch === "arm64") {
|
|
48
48
|
return "darwin-arm64";
|
|
49
49
|
}
|
|
50
|
-
if (platform === "darwin" && arch === "x64") {
|
|
51
|
-
return "darwin-x64";
|
|
52
|
-
}
|
|
53
50
|
return null;
|
|
54
51
|
}
|
|
55
52
|
|