Skip to content

feat: code-screenshot template with syntax highlighting #93

Description

@ajianaz

Demand source: carbon.now.sh (36k+ GitHub stars) proves this is the most sought-after developer category. Cosy has snippet-* templates (mono, single color) but no highlighting.

Proposed design:

  1. code-screenshot template (1200x750 default): window chrome (traffic lights), filename header, code area.
  2. Simple server-side syntax highlighting in Rust (without a tree-sitter dependency if possible): regex-based tokenizer for keyword/string/comment/number/function per language (Go, Rust, TS, Python, Bash). Emit colored tspans (Catppuccin theme + light).
  3. Fields: code (markup disabled, preserve newline/tab), language (for the tokenizer), filename, theme.
  4. Tab-to-space expansion, optional line numbers.

Acceptance:

  • Renders Go/Rust/TS snippets with a different color per token class.
  • No heavy new dependency (tree-sitter optional behind a flag).
  • Line counts > 20 still fit (auto font-size or scroll cut).

Effort: M (1-2 days). Priority #2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestoutput-formatsPNG/WebP/SVG/PDF output container workv0.5.0Template batch release

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions