$ show sadreck/ThermalMarky
ThermalMarky is a web application and CLI tool that converts Markdown text into formatted ESC/POS commands for thermal receipt printers. The system is built with FastAPI for the HTTP server and python-escpos for printer communication. It features a clean web UI (single HTML page with Bootstrap) and a command-line interface for piping or file input. The architecture is a straightforward monolith: the web endpoint accepts markdown, saves it to a temporary file, then invokes the CLI script via subprocess. The core library modules handle configuration (with content overrides via HTML comments), input loading (stdin/file), markdown parsing into tokens with formatting (bold, underline, headers, alignment, QR codes), and printer output with line-width wrapping and truncation. The project includes proper Docker support and environment variable configuration. It demonstrates good separation of concerns and a non-trivial markdown-to-ESC/POS converter that handles inline format toggling and scaled text width calculations.
The LLM identified 2 files worth highlighting for reuse:
Converts Markdown text into a list of PrinterText tokens with inline formatting (bold, underline, headers H1/H2, alignment, QR codes, line effects). The class is self-contained (only imports from formatting.py) and handles word-by-word line-width computation respecting character scaling (width/height). It can be extracted and reused as a library for rendering Markdown into ESC/POS formatting primitives.
Defines PrinterText and PrinterTextFormat dataclasses that encapsulate a character and its formatting attributes (bold, underline, alignment, scaling). These are simple, isolated data containers that could be extracted and reused in any thermal printing project that needs to manage formatted text tokens.