I want to include code in a markdown gist on github, and cannot work out how to do syntax highlighting.
github flavoured markdown - e.g.
```php
Class::function($param);
```
would highlight the syntax as php in an issue, for instance, but it seems not in a gist.
Fenced code blocks do work in Markdown Gists, and in fact your code is being rendered that way. If you inspect the blocks you'll see that they are contained in div
s with class="highlight highlight-PHP"
.
The problem is that PHP code is only recognized for highlighting by GFM if it includes the <?php
delimiter (much like PHP code only runs inside a <?php
block). Add this to the top of each PHP code block and you should be good to go, e.g.:
...
```php
<?php
class GO_Example_Model_Thing extends GO_Base_Db_ActiveRecord {
...