Skip to content

Instantly share code, notes, and snippets.

@eliotsykes
Last active October 24, 2015 14:52
Show Gist options
  • Save eliotsykes/edb55ba9afae7ca34511 to your computer and use it in GitHub Desktop.
Save eliotsykes/edb55ba9afae7ca34511 to your computer and use it in GitHub Desktop.
Markdown code block example using backticks

Triple backticks are used to open and close code blocks. The triple backticks need to be on their own line:

puts "hello world"

And here is another, separate code block. Triple backticks open and close it:

puts "line 1"
puts "line 2"
puts "line 3"

Triple backticks can be used with a language keyword (e.g. one of ruby, bash, javascript) to print code with colored syntax highlighting.

Here's some Ruby:

puts "Hello"
puts "Goodbye"

Here's some JavaScript:

var x = 2 + 2;
alert("The answer is: " + x);

And here's some Bash:

ls
echo "Hi"

The end (not in a code block).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment