Skip to content

feat: additional syntax highlighting — PHP, C/C++, Swift, Terraform/HCL, Dockerfile (v1.7.0) #78

Description

@shouze

Context

Part of the 🛠 Developer experience EPIC #77, targeting v1.7.0.

Goal

Extend the regex-based syntax highlighter (src/render/highlight.ts) with five new language profiles. The existing pattern is trivially extensible — each language just needs a new entry in detectLang and a new tokenRules entry.

Languages to add

Language Extensions Key tokens
PHP .php, .phtml Keywords (function, class, echo…), $variables, strings, comments (//, #, /* */)
C/C++ .c, .h, .cpp, .cc, .cxx, .hpp, .hxx Keywords (int, void, struct…), preprocessor (#include, #define), strings, comments
Swift .swift Keywords (var, let, func, class, guard…), strings, comments
Terraform / HCL .tf, .hcl Block keywords (resource, variable, output, module), booleans, strings, # comments
Dockerfile Filenames matching Dockerfile, dockerfile Instructions (FROM, RUN, CMD, EXPOSE, ENV…), comments

Acceptance criteria

  • Each new language produces ANSI-colored output (ANSI codes present in output)
  • Language detection is tested via the detectLang path (extension → tokenizer)
  • Dockerfile detection works on filename, not extension
  • At least one tokenizer test per language (keyword colorized, comment colorized, string colorized)
  • All existing tests still pass

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions