HOWTO: Highlight PHP and JavaScript Code with PHP |
From the article:
Highlight PHP and JavaScript Code with PHP | CSS-Tricks
PHP has a cool function that automatically highlights PHP code called highlight_string(); Theoretically this could be used to roll your own code highlighting on a site, rather than rely on JavaScript or some kind of external service to do it. In this article I'll show you the basics of how it works, then extended it with a few tricks. Since JavaScript is so similar to PHP in syntax, we can trick the function into highlighting JavaScript code as well. Then finally how we can bust out some smarts to auto-tab the code.
WordPress.com | Thanks for flying with WordPress! |
Comments (0)
Post a Comment