Is Brent Roose on the Fediverse anywhere? I love this idea, and I’d love to help contribute.

I started down the path of trying to port #Pygments to #PHP a while back. I maintained a PHP wrapper for it (https://github.com/ramsey/pygments), and even set up a GitHub organization for “Phygments.” 😉 https://github.com/phygments

I want to help make this happen. Maybe I’ll have to email Brent if he’s not on the Fediverse.

@freekmurze @pronskiy Do either of you know if he’s here? https://mastodon.social/@php_discussions/112118298296419881

GitHub - ramsey/pygments: 💅 A PHP wrapper for Pygments, the Python syntax highlighter, forked from the Pygments.php project

💅 A PHP wrapper for Pygments, the Python syntax highlighter, forked from the Pygments.php project - ramsey/pygments

GitHub
@freekmurze @pronskiy The idea behind Phygments was that it be a pure PHP port that could potentially use the existing Pygments grammar files so it could support all the same languages.
@ramsey sadly he’s not. I had a conversation with him on Twitter a while back but he seemed reluctant 😢

@michael Did he say why?

I have trouble understanding why people are staying on that platform. Anyone who is still active on Twitter is financially supporting Elon Musk and anyone he’s indebted to. Even if not directly paying for the pro features, you count as a MAU, which entices advertisers to continue advertising.

@ramsey yeah, he basically wanted to reduce his reliance on social media, and instead focus on his blog. He didn’t want to have move again if things went tits up / be at someone else’s mercy.

I sort of get that reasoning partially but like you don’t agree with the conclusion…

@michael I understand that, too, but once Musk took over and has shown himself to be increasingly evil, it was pretty clear to me that I didn’t want to stick around to support him, if I could help it.

I used to receive Brent’s mailing list posts in my inbox, but then they started going to spam. I kept marking them as “not spam,” but then I stopped receiving them altogether, so I assumed he wasn’t posting.

@michael Brent has such a big audience, he could set up his own ActivityPub instance like you (or just set up his blog as an ActivityPub server) and convince his audience to move with him. I’m sure many would follow to keep up with his content.
@michael What’s worse is that I subscribe to his RSS feed in NetNewsWire, and his last few blog posts aren’t reflected in his RSS feed, so it wasn’t until I saw this post from @php_discussions that I knew he had new content.
@ramsey i think in practice he’s now mostly on YouTube (aside from twitter obvs).

@ramsey I got one yesterday I think, so he is still sending.

But, yes: he wanted to focus on that newsletter.

I guess that was a year ago though, so things might have changed. But I feel those still left on Twitter now, likely will never * move …

You cannot find me on Mastodon - stitcher.io

A blog about modern PHP, the web, and programming in general. Follow my newsletter and YouTube channel as well.

@ramsey When I saw this my first thought was that someone should put some energy into updating the code underlying highlight_file(). It could be marked up with classes instead of colors, and actually distinguish between more token types. That doesn’t help with other languages, of course.

For other languages, I agree that leveraging someone else’s syntax files is the way to go.

@jimw I just remembered that all of the “grammars” are just Python classes with a bunch of regex definitions. Those would have to be converted to PHP, which could be automated, but some of the regex might need to be rewritten to match PCRE syntax.

https://github.com/pygments/pygments/tree/master/pygments/lexers

pygments/pygments/lexers at master · pygments/pygments

Pygments is a generic syntax highlighter written in Python - pygments/pygments

GitHub

@ramsey The syntax highlighting I use on my blog is some very old JavaScript code that is based on the GNU Source-Highlight package. The language files use the Boost Regex format and it was all converted to JavaScript structures by some Perl code. I spent an afternoon trying to update it to the latest syntax files but hit some roadblocks. (But the GNU package hasn’t had a release for four years, either.)

There’s a Go package (chroma) that is based on the Pygments lexers but has converted them to an XML format, that might be easier to deal with. There must be some libraries for doing regex format conversion out there, if that’s necessary.

@jimw Ooh! The XML would definitely be useful, provided they keep that up-to-date with the latest changes made to the upstream Pygments project.
@ramsey Yeah, or if you could convince the Pygments project to also adopt the XML format so that it becomes the canonical one.
@ramsey Brent’s project looks very cool, but I also think that Ryan Chandler is about to release a syntax highlighter that uses TextMate grammar files, which will mean that it can immediately highlight almost all major languages. Very curious how the two projects turn out!
@chris Cool! Guess I don’t need to contribute or work on Phygments, now. 😅
@chris @ramsey I'd really prefer a TextMate solution, too. Brent claimed it would be "easy" to add new syntaxes. But why should we if TextMate already had it figured out?
@denniskoch @chris My approach was to reuse the “grammars” from the pygments project, since it’s very robust and well maintained, but if TextMate files are easier for everyone, then that might work better.
@ramsey @chris Not sure whether it's easier. But it's the common one. VS Code uses it. PhpStorm uses it. Sublime Text uses it.
@denniskoch @chris Oh, I didn’t realize it’s what all those used. I had thought pygments was the de facto standard when it came to syntax highlighting.

@denniskoch @ramsey Yeah, that's the nice thing about TextMate grammars… they've basically become the industry standard.

Here's Ryan's recent post about the progress of his project:

https://twitter.com/ryangjchandler/status/1769434118981288017

Ryan Chandler (@ryangjchandler) on X

Although I didn't have any spare time this weekend to livestream some programming, I am still getting ready to release my syntax highlighting package for PHP projects. Here's a sneak peek at some code being highlighted with my new package on my blog... 👀

X (formerly Twitter)
@chris @denniskoch It’s kind of weird, since I didn’t think TextMate was actively developed anymore.
@chris @denniskoch Also, I don’t have a Twitter account, so I can’t read that tweet. 🙂

@ramsey Oh that's right… Tweets are behind a login now, eh?

It really sucks that the vast majority of the Laravel community is still stuck on Twitter. I would love to move 100% to Mastodon, but I would be losing nearly my entire dev community if I did :(

@chris I miss seeing posts from lots of folks who didn’t move, but I can’t in good conscience put money into Elon Musk’s pockets (or the pockets of his Saudi investors) by paying for premium features or driving up the MAUs, so I made the decision to completely cut ties.

@ramsey I admire your fortitude!

In the end, I decided that many companies whose products I use or buy (sadly) have really problematic owners/investors. I'm not going to let Musk further ruin the real, good value I get from my community on Twitter.

@chris I make changes where I’m able. One of my accounts on Twitter had 85k followers, but since I didn’t use it to make money, I was able to leave it behind. My personal account had 13k followers, and for the same reason, I could leave it behind.

I’ve stopped using other products & services, for various ethical reasons, but as with anything, if I don’t have a good alternative, I’m stuck using the thing.

I’m hoping you can convince others to follow you because alternatives do exist. 🙂

@chris @ramsey You can do it Chris, be the change you want to see in the world.
@emd @ramsey I run rtsn.dev and am actively recruiting Laravel folks over here!
@chris @ramsey oh awesome, hadn't heard of that before will promote!
@chris @ramsey It is definitely more Laravel on Twitter
@ramsey @denniskoch I think that Sublime piggybacked on TextMate grammars so that they didn't need to develop their own, and then VS Code did the same. The IntelliJ IDEs have their own implementation, but they support TextMate grammars for languages that aren't built-in, I'm pretty sure.