egwfmw
Last Updated: February 25, 2016
·
2.94K
· aimfeld
7c26f3d9b53b938d47df84f24b5c1561

Code blocks on GitHub and coderwall

GitHub has some cool additional markdown functionality called GitHub Flavored Markdown. When inserting code blocks in GitHub pages, messages, issues, or comments, I recommend using "fenced code blocks" instead of indentation. This makes editing and copy-pasting easier and you can use syntax highlighting in various programming languanges!

This is how you create a syntax-highlighted PHP fenced (```) code block (also works on coderwall, but currently not in the preview):

```php
class ExampleDiFactory extends DiFactory
{
    // code
}
```

On GitHub, it will display like this:

Picture

Say Thanks
Respond

2 Responses
Add your response

4994
69ef5d19ed581a0fcc98857d0e89527d

I was trying to use a code fence and it was not working in the preview. Thanks for letting me know that it does not work in preview, but works when published.

over 1 year ago ·
14027
Snapshot 20140412 3  2

LoL Realy usefull Share i Googled to find this Pro Tip LoL Amazing when i would run codewall i would invest the 30 min to implament javascript markdown interpreter for the preview :D

over 1 year ago ·
Filed Under