Advanced Formatting

Formatting like syntax highlighting and embedding other sites allows you to arrange complex information.

Code and Syntax Highlighting

Code blocks are part of the Markdown spec, but syntax highlighting isn’t. However, many renderers - like GitHub or most Jekyll themes - support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. You can find the full list of supported programming languages here. Also, it is possible to do fenced code blocks, by wrapping the text in ` ` ` quotations.

Fenced code blocks

```
No language indicated, so no syntax highlighting.
```
No language indicated, so no syntax highlighting.

Markdown syntax highlighting

Add an optional language identifier to enable syntax highlighting in your fenced code block.

```ruby
def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
```
def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.

Rouge syntax highlighting

{=% highlight js %}
// Example can be run directly in your JavaScript console

// Create a function that takes two arguments and returns the sum of those arguments
var adder = new Function("a", "b", "return a + b");

// Call the function
adder(2, 6);
// > 8
{% endhighlight %}
// Example can be run directly in your JavaScript console

// Create a function that takes two arguments and returns the sum of those arguments
var adder = new Function("a", "b", "return a + b");

// Call the function
adder(2, 6);
// > 8

Embed Gist

Another option is to embed your code through Gist.

<script src="https://gist.github.com/mojombo/19.js"></script>

Embedding

Plenty of social media sites offer the option of embedding certain parts of their site on your own site, such as YouTube and Twitter:

Youtube

Twitter

Inline HTML elements

HTML defines a long list of available inline tags, which you can mix with Markdown if you like. A complete list of which can be found on the Mozilla Developer Network.

Useful Resources

More information on Markdown can be found at the following links: