Files
AboveTheMark/AGENTS.md
2026-10-20 20:17:01 -04:00

52 lines
1.7 KiB
Markdown

# AboveTheMark - GFM Editor
A React/Vite single-file markdown editor with LaTeX/SVG rendering, PDF/DOCX export.
## Quick Start
```bash
npm run dev # http://localhost:3000
npm run build # dist/index.html (standalone ~16KB)
```
Open `dist/index.html` directly in any browser—no server required.
## Build Targets
- **Singlefile HTML** (`SINGLEFILE=1 vite build`) — self-contained, offline-capable (~16KB)
- **IWA/Chrome Extension** (`npm run build:iwa`) — Installer for Web Applications manifest at `public/iwa/manifest.json`
- **PWA** — installable app with service worker in `dist/sw.js`
## Project Structure
```
src/ # React components (App.jsx, Editor.jsx, Toolbar.jsx)
components/ # MarkdownEditor, LaTeXRenderer, SvgRenderer
hooks/ # useTheme, useKeyboardShortcuts
utils/ # exportDocx, importDocx, fileIo, exportPdf
public/ # sample.md, favicon.svg, icons.svg, iwa/ (Chrome extension manifest)
dist/ # Production build (single index.html + assets)
```
## Toolchain Quirks
- **Linting**: `oxlint` with React plugin (`react/rules-of-hooks`, `only-export-components`)
- **Minification**: Terser via Vite (`minify: 'terser'`)
- **Singlefile build**: Inline all assets (KaTeX fonts, CSS) as data URIs when `SINGLEFILE=1`
## Keyboard Shortcuts
| Key | Action |
|-----|--------|
| Ctrl+S / Cmd+S | Save as .md |
| Ctrl+O / Cmd+O | Open markdown file |
| Ctrl+P / Cmd+P | Export PDF (browser print) |
| Ctrl+Shift+S | Export DOCX |
| Ctrl+Shift+I | Import DOCX |
## Dev Notes
- Dependencies load from CDN; offline works after first visit
- KaTeX renders `$$...$$` and `$...$` math expressions
- SVGs supported via markdown images, raw HTML tags, or code blocks with language tag