Skill: yatesdr/ticketmax (version 0.1.3)

--- name: ticketmax description: Print markdown files to an ESC/POS thermal receipt printer over TCP, USB, or serial. Supports headings, bold, underline, tables, images, QR codes, paper cuts, and buzzer. version: 0.1.3 metadata: openclaw: emoji: "🖨️" homepage: https://github.com/yatesdr/ticketmax requires: env: - PRINTER_ADDR bins: - ticketmax primaryEnv: PRINTER_ADDR install: - kind: go package: github.com/yatesdr/ticketmax@latest bins: - ticketmax --- # ticketmax Print markdown files to a thermal receipt printer. Write a `.md` file with standard markdown and ticketmax renders it on any ESC/POS printer over TCP, USB, or serial. ## Setup Set `PRINTER_ADDR` to your printer's address: ```bash # TCP: export PRINTER_ADDR=192.168.1.100:9100 # USB: export PRINTER_ADDR=/dev/usb/lp0 # Serial: export PRINTER_ADDR=/dev/ttyUSB0 ``` ## Usage ```bash # Print a markdown file ticketmax report.md # Pipe from stdin echo "# Hello World" | ticketmax - # Check printer connectivity ticketmax -status # Print a test receipt ticketmax -test ``` ## Flags | Flag | Default | Description | |---|---|---| | `-addr` | `127.0.0.1:9100` | Printer host:port or device path (env: `PRINTER_ADDR`) | | `-baud` | `9600` | Baud rate for serial connections | | `-timeout` | `5s` | Network connection timeout | | `-width` | `46` | Paper width in characters (1–120) | | `-spacing` | `20` | Line spacing in printer units (0–255) | | `-test` | | Print test receipt and exit | | `-status` | | Check connectivity and exit | ## Markdown Syntax | Markdown | Printer Output | |---|---| | `# Heading` | Bold, double-size, centered | | `## Heading` | Bold, double-width, centered | | `### Heading` | Bold | | `**bold text**` | Bold line | | `<u>text</u>` | Underlined line | | `---` | Separator line | | `\| A \| B \|` | Two columns (right-aligned values) | | `\| A \| B \| C \|` | Three columns | | `![alt](path)` | Print image (PNG, JPEG, GIF) | | `` ```qr `` | QR code block | | `<!-- cut -->` | Cut paper | | `<!-- beep -->` | Buzzer (1 beep) | | `<!-- beep N -->` | Buzzer (N beeps) | ## Example To print a report, write markdown to a temp file and pipe it to ticketmax: ```bash cat <<'EOF' > /tmp/report.md # Morning Report ## Sales | Item | Revenue | | --- | --- | | Widget A | $1,234 | | Gadget B | $567 | --- **Low stock: Widget A (3 units)** ```qr https://dashboard.example.com ``` <!-- beep --> EOF ticketmax /tmp/report.md ``` Or pipe directly from stdin: ```bash echo "# Alert\n\n**Server down at $(date)**\n\n<!-- beep 3 -->" | ticketmax - ```

path: README.md
content: # ticketmax

Print markdown files to ESC/POS thermal receipt printers. Headings, bold,
underline, tables, images, QR codes, paper cuts, and buzzer — all from
standard `.md` files.

Connects over TCP, USB, or serial. Works with any ESC/POS printer (tested with Rongta).

## Quick Start

```bash
# Install
go install github.com/yatesdr/ticketmax@latest

# Or build from source
git clone https://github.com/yatesdr/ticketmax.git
cd ticketmax
make build
```

```bash
# Set your printer address (or pass -addr each time)
# TCP:
export PRINTER_ADDR=192.168.1.100:9100
# USB:    export PRINTER_ADDR=/dev/usb/lp0
# Serial: export PRINTER_ADDR=/dev/ttyUSB0

# Check connectivity
ticketmax -status

# Print a test receipt
ticketmax -test

# Print a markdown file
ticketmax examples/morning-report.md

# Pipe from stdin
echo "# Hello World" | ticketmax -
```

## Usage

```
ticketmax [flags] <file.md | ->
```

### Flags

| Flag | Default | Description |
|---|---|---|
| `-addr` | `127.0.0.1:9100` | Printer host:port or device path (env: `PRINTER_ADDR`) |
| `-baud` | `9600` | Baud rate for serial connections |
| `-timeout` | `5s` | Network connection timeout |
| `-width` | `46` | Paper width in characters (1–120) |
| `-spacing` | `20` | Line spacing in printer units (0–255) |
| `-test` | | Print test receipt and exit |
| `-status` | | Check connectivity and exit |
| `-version` | | Print version and exit |

### Line Spacing

The `-spacing` flag controls line density. Each unit is ~1/180 inch.

| Value | Density |
|---|---|
| `0` | Printer default |
| `16` | Very tight (~2.3 mm) |
| `20` | Tight (~2.8 mm) — **default** |
| `30` | Normal (~4.2 mm) |

## Markdown Syntax

| Markdown | Printer Output |
|---|---|
| `# Heading` | Bold, double-size, centered |
| `## Heading` | Bold, double-width, centered |
| `### Heading` | Bold |
| `**bold text**` | Bold line |
| `<u>text</u>` | Underlined line |
| `---` | Separator |
| `\| A \| B \|` | Two columns (right-aligned values) |
| `\| A \| B \| C \|` | Three columns |
| `![alt](path)` | Image (PNG, JPEG, GIF) |
| `` ```qr `` | QR code block |
| `<!-- cut -->` | Cut paper |
| `<!-- beep -->` | Buzzer (1 beep) |
| `<!-- beep N -->` | Buzzer (N beeps) |

### Example

```markdown
# Morning Report

## Sales

| Item | Revenue |
| --- | --- |
| Widget A | $1,234 |
| Gadget B | $567 |

---

**Low stock: Widget A (3 units)**

```qr
https://dashboard.example.com
```

<!-- cut -->
```

## Agent Skill

ticketmax includes a skill definition (`SKILL.md`) so it can be used by
Claude Code agents and OpenClaw bots. Any tool that writes markdown can print
to a receipt printer:

```bash
# Pipe output from another tool
your-app export --format=md | ticketmax -

# Cron job
ticketmax /path/to/daily-report.md

# OpenClaw bot
@bot write a morning report in markdown and print it
```

## Examples

See `examples/` for ready-to-use templates:

- `morning-report.md` — daily sales, inventory alerts, QR dashboard link
- `sales-receipt.md` — customer receipt with totals
- `shift-summary.md` — hourly breakdown with handoff notes
- `feature-test.md` — exercises every supported markdown feature

## Building

```bash
make build              # current platform
make all                # linux, windows, macOS (amd64 + arm64)
make test               # run tests
make build VERSION=1.0  # set version string
```


path: examples/feature-test.md
content: # Feature Test

## All Formats

### H3 Bold Heading

---

**Bold line of text**

<u>Underlined line of text</u>

Plain text line

This is a really long sentence that should definitely wrap across multiple lines on the thermal printer so we can see exactly how the printer handles text that exceeds the paper width and whether it breaks cleanly or cuts off characters at the edge of the receipt.

***

| Left Column | Right Column |
| --- | --- |
| Espresso | $4.50 |
| Croissant | $3.75 |
| Tax | $0.66 |

___

| Col 1 | Col 2 | Col 3 |
| --- | --- | --- |
| Qty | Item | Price |
| 2 | Widget | $5.00 |
| 1 | Gadget | $12.99 |

---

![German Shepherd](examples/german-shepherd.png)

```qr
https://github.com/ticketmax
```

Printed on 2026-04-02

<!-- beep 3 -->

<!-- cut -->

# Second Page

This tests mid-document cut.

If you see this, cut works!

<!-- beep -->


path: examples/morning-report.md
content: # Morning Report

## Sales Summary

| Item | Revenue |
| --- | --- |
| Widget A | $1,234.56 |
| Gadget B | $567.89 |
| Service C | $890.12 |

---

## Inventory

| Item | Qty | Status |
| --- | --- | --- |
| Widget A | 3 | REORDER |
| Part D | 5 | LOW |
| Gadget B | 42 | OK |

---

<u>Action required: reorder Widget A today</u>

### Notes

Morning standup at 9:30 AM
Shipment arriving at 2 PM
Maintenance window tonight 11 PM - 1 AM

```qr
https://dashboard.example.com/daily
```

<!-- beep 2 -->


path: examples/sales-receipt.md
content: # ACME CORP

### Sales Receipt

| Item | Price |
| --- | --- |
| Widget A x2 | $25.98 |
| Gadget B x1 | $19.99 |
| Service Plan | $49.99 |

---

| Subtotal | $95.96 |
| Tax (8%) | $7.68 |

**TOTAL: $103.64**

Payment: Visa ****1234

---

Thank you for your business!

```qr
https://feedback.example.com/receipt/20260402
```


path: examples/shift-summary.md
content: # Shift Summary

## 6:00 AM - 2:00 PM

### Performance

| Metric | Value |
| --- | --- |
| Total Sales | $4,567.89 |
| Transactions | 62 |
| Avg Sale | $73.67 |
| Returns | 3 |

---

### Hourly Breakdown

| Hour | Sales | Txns |
| --- | --- | --- |
| 6-7 AM | $234.56 | 4 |
| 7-8 AM | $567.89 | 8 |
| 8-9 AM | $890.12 | 12 |
| 9-10 AM | $678.90 | 10 |
| 10-11 AM | $456.78 | 8 |
| 11-12 PM | $345.67 | 7 |
| 12-1 PM | $234.56 | 6 |
| 1-2 PM | $159.41 | 7 |

---

**Next shift starts at 2:00 PM**

Handoff notes: Register 2 low on receipt paper


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)