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:
neil 2026-11-02 00:30:13 -08:00
parent f4232ef9b5
commit dc2b12a3c6
37 changed files with 3704 additions and 27 deletions

View file

@ -3,6 +3,13 @@
// To add a tool: create js/tools/<id>.js exporting mount(el, ctx) (see app.js for ctx),
// then add an entry here. A tool owns every path under its `path`, so /paste/abc123
// goes to the paste tool with ctx.rest = "abc123".
//
// Optional fields:
// opensPaste: true the tool loads <path>?paste=<id>; it then appears in a paste's "Open in" menu
// badge: () => number a count shown on the tool's nav item (0 hides it); call
// window.dispatchEvent(new Event('tools:badges')) when it changes
import { unreadCount } from './tools/paste-state.js';
export const TOOLS = [
{
id: 'markdown',
@ -11,8 +18,19 @@ export const TOOLS = [
category: 'Text',
icon: 'M↓',
description: 'Write Markdown with a live preview: side by side, editor only or full-page preview.',
opensPaste: true,
load: () => import('./tools/markdown.js'),
},
{
id: 'syntax',
name: 'Syntax Highlighting',
path: '/syntax',
category: 'Code',
icon: '</>',
description: 'Highlight and format source code with VS Code and Android Studio themes, then copy it as rich text or RTF.',
opensPaste: true,
load: () => import('./tools/syntax.js'),
},
{
id: 'json',
name: 'JSON editor',
@ -20,6 +38,7 @@ export const TOOLS = [
category: 'Data',
icon: '{ }',
description: 'Validate, prettify and compact JSON, with a live tree view you can edit.',
opensPaste: true,
load: () => import('./tools/json.js'),
},
{
@ -29,9 +48,10 @@ export const TOOLS = [
category: 'Sharing',
icon: '⎘',
description: 'Share text with a short link. Pastes are deleted after 24 hours.',
badge: unreadCount,
load: () => import('./tools/paste.js'),
},
];
// Sidebar groups appear in this order; unknown categories go last, alphabetically.
export const CATEGORY_ORDER = ['Text', 'Data', 'Sharing'];
export const CATEGORY_ORDER = ['Text', 'Code', 'Data', 'Sharing'];