NAME and SLOGAN are read from .env via dotenv and injected into the LinkedIn preview card template at startup. Avatar initials are auto- generated from the first letters of NAME. Works identically with npm start and docker compose (via env_file). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
2.4 KiB
Markdown
48 lines
2.4 KiB
Markdown
# CLAUDE.md
|
||
|
||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||
|
||
## Project Overview
|
||
|
||
A self-hosted LinkedIn Post Formatter that converts text with formatting markers (`**bold**`, `_italic_`) into Unicode Mathematical Alphanumeric Symbols. LinkedIn only accepts plain Unicode text (no HTML/Markdown), so the tool converts text into Unicode variants that *appear* formatted in the LinkedIn feed.
|
||
|
||
## Running the Project
|
||
|
||
```bash
|
||
npm start # Start server on port 3000
|
||
PORT=8080 node server.js # Custom port
|
||
docker compose up -d # Docker deployment
|
||
```
|
||
|
||
There are no build, test, or lint steps.
|
||
|
||
## Architecture
|
||
|
||
The project is intentionally minimal:
|
||
|
||
- **`server.js`** — 16-line Express server that only serves static files from `public/` and supports a `PORT` env var.
|
||
- **`public/index.html`** — The entire application: HTML, CSS, and JavaScript all inlined in one file (~289 lines). No frameworks, no bundler, no external dependencies.
|
||
|
||
All formatting logic lives in `public/index.html` as vanilla JavaScript:
|
||
|
||
- `applyInline(text, variant)` — Processes `**text**` (bold) and `_text_` (italic) markers within a variant pass
|
||
- `mapAll(text, map)` — Applies Unicode character mapping char-by-char
|
||
- `liParagraph(text)` — Inserts zero-width spaces (`\u200b`) between double newlines to preserve paragraph breaks when pasting into LinkedIn (which strips trailing blank lines)
|
||
- Six output variants: Sans (standard), Bold Sans, Italic Sans, Bold Italic Sans, Monospace, Plain
|
||
|
||
The Unicode character maps are JavaScript objects mapping A–Z, a–z, 0–9 to their Unicode Mathematical Alphanumeric equivalents (e.g., bold sans, italic sans, monospace).
|
||
|
||
## Key Implementation Details
|
||
|
||
**Zero-width space trick:** LinkedIn strips trailing blank lines on paste. The app inserts `\u200b` between `\n\n` sequences to preserve paragraph structure.
|
||
|
||
**Character limit:** LinkedIn max is 3000 characters. The counter uses color-coded feedback (green → amber → red) with `toLocaleString('de-DE')` formatting.
|
||
|
||
**Clipboard fallback:** Uses `navigator.clipboard.writeText()` with a `document.execCommand('copy')` fallback for older browsers.
|
||
|
||
**Keyboard shortcuts:** Ctrl/Cmd+B (bold), Ctrl/Cmd+I (italic), Ctrl/Cmd+Enter (generate preview).
|
||
|
||
## Language
|
||
|
||
The UI and all user-facing text is in **German**. Keep new UI additions in German.
|