Hacker News new | ask | show | jobs
by f311a 36 days ago
Why reinvent the wheel? Syntax highlighting, git. I'm pretty sure there are PHP libraries to do that.

Your syntax highlighting is very basic as well. Just ask LLMs to provide tests where it would fail to render correctly.

The first thing that comes to mind after looking at it: print("# not a comment")

1 comments

> Why reinvent the wheel?

Dependency-free, performance, FORTRAN, and it would take me more than ten minutes to find and integrate a highlighter that works across all of my code bases.

I searched for PHP-based Git libraries. All of them either invoked "git" using a system call or offered write abilities to the repo. I wanted a pure PHP solution that did not write to any files or invoke executable files (for security purposes). Maybe I didn't search long enough; at some point it becomes faster to tell the LLM what's wanted than to find a solution that fits.

> print("# not a comment")

Works correctly?

https://i.ibb.co/chgVkTz4/not-a-comment.png