Syntax Highlighting tool, Markdown guide, unread share badge, Open in menu
- Syntax Highlighting (/syntax): highlight.js tokens rendered with VS Code (Dark/Light Modern, One Dark Pro, Monokai, Dracula, GitHub) and Android Studio (Darcula, Dark, IntelliJ Light) colors; copy as rich text (VS Code clipboard HTML), download RTF, share. Format via Prettier/sql-formatter (lazy-loaded), the JSON printer, or built-in whitespace-only formatters for brace languages, Python and XML. - Markdown: Guide dialog, source next to rendered output, with Insert. - Pastes created by Share count as unread on the Pastebin nav badge. - Paste view: Open in menu built from registry opensPaste tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f4232ef9b5
commit
dc2b12a3c6
37 changed files with 3704 additions and 27 deletions
37
README.md
37
README.md
|
|
@ -4,13 +4,37 @@ Small browser tools at **https://tools.neilbantoc.dev**:
|
|||
|
||||
| Tool | Path | Runs |
|
||||
| --- | --- | --- |
|
||||
| Markdown: edit, side by side, or full-page preview | `/markdown` | in the browser |
|
||||
| Markdown: edit, side by side, or full-page preview; syntax guide | `/markdown` | in the browser |
|
||||
| Syntax Highlighting: VS Code / Android Studio themes, Format, copy as rich text, RTF | `/syntax` | in the browser |
|
||||
| JSON editor: validate, format, compact, sort keys, editable live tree | `/json` | in the browser |
|
||||
| Pastebin with 24-hour expiry | `/paste`, `/paste/<id>`, `/raw/<id>` | server (SQLite) |
|
||||
|
||||
Drafts (Markdown, JSON, an unsent paste) are saved in the browser's localStorage.
|
||||
`/markdown?paste=<id>` and `/json?paste=<id>` open a paste in those tools without
|
||||
overwriting the local draft; Markdown's **Share** button makes such a link.
|
||||
Drafts are saved in the browser's localStorage. Any tool marked `opensPaste` in the registry
|
||||
opens `<path>?paste=<id>` without overwriting the local draft, and appears in a paste's
|
||||
**Open in** menu. **Share** buttons (Markdown, Syntax Highlighting) create such a link; the paste
|
||||
counts as unread on the Pastebin nav badge until it's opened.
|
||||
|
||||
### Syntax Highlighting
|
||||
|
||||
highlight.js tokenizes; the theme colors (`js/tools/highlight-themes.js`) are applied as inline
|
||||
styles in the same HTML shape VS Code puts on the clipboard, so pasting into Docs, Word, Slides,
|
||||
Outlook, Slack or Notion keeps them. RTF comes from the same tokens.
|
||||
|
||||
**Format** depends on the language:
|
||||
|
||||
| Languages | Engine |
|
||||
| --- | --- |
|
||||
| JS, TS, CSS/SCSS/Less, HTML, YAML, Markdown, GraphQL | Prettier 3.9.10 (loaded on first use) |
|
||||
| SQL | sql-formatter 15.9.0 (on first use) |
|
||||
| JSON | the JSON tool's lossless printer |
|
||||
| Kotlin, Java, C/C++/C#/Obj-C, Go, Rust, Swift, Dart, PHP, Scala, Groovy, Protobuf | built-in brace formatter: re-indent, operator/comma/keyword spacing, K&R braces (Allman for C#), case bodies, continuation lines |
|
||||
| Python | built-in: block re-indent to 4, PEP 8 spacing (kwargs, slices, inline comments) |
|
||||
| XML (non-HTML) | built-in: one attribute per line for Android-style XML or long tags |
|
||||
| anything else | trailing whitespace and blank lines only |
|
||||
|
||||
The built-in formatters only ever change whitespace: strings and comments are masked out first,
|
||||
and the tests assert that stripping all whitespace from input and output gives the same text,
|
||||
and that formatting twice changes nothing. They don't wrap long lines or reorder anything.
|
||||
|
||||
## Layout
|
||||
|
||||
|
|
@ -24,10 +48,11 @@ app/
|
|||
js/app.js router, nav, theme
|
||||
js/ui.js shared helpers (el, toast, copy/download, store, segmented, …)
|
||||
js/tools/*.js one module per tool
|
||||
vendor/ marked 18.1.2, DOMPurify 3.4.17 (vendored, no CDN)
|
||||
vendor/ marked 18.1.2, DOMPurify 3.4.17, highlight.js 11.12.0, Prettier 3.9.10,
|
||||
sql-formatter 15.9.0 + nearley 2.20.1 (vendored, no CDN)
|
||||
compose.yml production container (host network, 127.0.0.1:8090)
|
||||
deploy.sh tests, copies to /opt/tools on the server, rebuilds, waits for healthy
|
||||
tests/ node --test tests/ (JSON parser/printer)
|
||||
tests/ node --test tests/ (JSON parser/printer, formatters, highlighter)
|
||||
```
|
||||
|
||||
No build step: the browser loads the ES modules directly.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue