mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-24 08:28:50 -05:00
1.5 KiB
1.5 KiB
layout | title | date | sidebar | footer |
---|---|---|---|---|
page | Backtick Code Blocks | 2011-07-26 23:42 | false | false |
With the backtick_codeblock
filter you can use Github's lovely back tick syntax highlighting blocks.
Simply start a line with three back ticks followed by a space and the language you're using.
Syntax
``` [language] [title] [url] [link text] [start:#]
code snippet
```
Example (plain)
```
$ sudo make me a sandwich
```
$ sudo make me a sandwich
Example With Syntax Highlighting a Caption and Link
``` ruby Discover if a number is prime http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/ Source Article
class Fixnum
def prime?
('1' * self) !~ /^1?$|^(11+?)\1+$/
end
end
```
class Fixnum
def prime?
('1' * self) !~ /^1?$|^(11+?)\1+$/
end
end
Example with a custom starting line number
``` coffeescript Coffeescript Tricks start:51
# Given an alphabet:
alphabet = 'abcdefghijklmnopqrstuvwxyz'
# Iterate over part of the alphabet:
console.log letter for letter in alphabet[4..8]
```
# Given an alphabet:
alphabet = 'abcdefghijklmnopqrstuvwxyz'
# Iterate over part of the alphabet:
console.log letter for letter in alphabet[4..8]