The Blog

Github Code Block Types

When working with code blocks, sometimes you need to know the acronym associated with a language in order to create the block. For example, when working with a Wiki in Github, a code block can be create by entering three back-ticks. Followed by the language type. A carriage return. The code itself and then another three back-ticks (see example):

This Code

```php
// php code should go here
```

Produces This Output

“`php
// php code should go here
“`

Library

I ran into an issue today where I wanted to know what language types were available to me. Some of the popular ones were obvious like php, ruby, java, etc. But, I was wondering if there was a comprehensive list I could easily refer to, like a cheat-sheet. It seems that Github might be using a reference yaml file to manage code markdown. From articles I’ve read, the following file is the standard:

https://github.com/github/linguist/blob/master/lib/linguist/languages.yml

But for quick reference:

“`bash
actionscript3
apache
applescript
asp
c
cfm
clojure
cmake
coffee-script, coffeescript, coffee
cpp – C++
cs
csharp
css
csv
bash
diff
elixir
erb – HTML + Embedded Ruby
go
haml
http
java
javascript
json
jsx
less
lolcode
make – Makefile
markdown
matlab
nginx
objectivec
pascal
PHP
Perl
python
profile – python profiler output
rust
salt, saltstate – Salt
shell, sh, zsh, bash – Shell scripting
sql
scss
sql
svg
swift
rb, jruby, ruby – Ruby
smalltalk
vim, viml – Vim Script
volt
vhdl
vue
xml – XML and also used for HTML with inline CSS and Javascript
yaml
“`

No comments yet.

Leave a Comment

Remember to play nicely folks, nobody likes a troll.

You must be logged in to post a comment.