torchlight-api / torchlight-laravel

A Laravel client for Torchlight - the syntax highlighting API.
https://torchlight.dev
MIT License
113 stars 17 forks source link

Looks like `<!-- Comments --> in PHP/HTML files do not work #34

Closed ralphjsmit closed 2 years ago

ralphjsmit commented 2 years ago

Hey Aaron! I've been converting my blog from WordPress to Laravel. With that I'm also switching to Torchlight.

One thing that struck me was the following code snippet:

Schermafbeelding 2022-03-10 om 18 03 51

This is a code snippet in a PHP that is rendered as HTML. In this case, the first line is just an HTML-comment, but it isn't grey like it should be.

Is this indeed a bug or should I use a different filetype than PHP?

Thanks!

aarondfrancis commented 2 years ago

Hmm that does indeed seem wrong, let me look into that really quick

aarondfrancis commented 2 years ago

Ok for files like that give php-html a try. I need to document that because it confused me too 😂

aarondfrancis commented 2 years ago

I'm working on a better solution to this.

ralphjsmit commented 2 years ago

Thank you for researching this! It works better, though it looks like the HTML-part isn't fully rendered/colored. Do you also have that?

Schermafbeelding 2022-03-11 om 08 35 13
aarondfrancis commented 2 years ago

Dang, you're right. Let me keep working on this! Will update you soon

ralphjsmit commented 2 years ago

No problem, nothing urgent👍

aarondfrancis commented 2 years ago

Fixed! You can use php and if it notices opening tags <?php it will default under-the-hood to php-html and actually highlight the HTML properly now

ralphjsmit commented 2 years ago

Great, thank you Aaron! You absolutely did a great job with Torchlight. Initially I was somewhat skeptical of doing an API-call for highlighting, but with the caching in Laravel it's very fast and beautiful.