📝 Edit on GitHub
Basics
Backticks vs highlight tag
Markdown code blocks
This works in Jekyll and plain markdown too.
Code:
```ruby
def foo
puts 'foo'
end
```
Result:
def foo
puts 'foo'
end
Highlight tag
This works in Jekyll only.
Code:
{% highlight ruby %}
def foo
puts 'foo'
end
{% endhighlight %}
Result:
def foo
puts 'foo'
end
With line numbers
Add linenos
to the tag.
Code:
{% highlight ruby linenos %}
def foo
puts 'foo'
end
{% endhighlight %}
Result:
1
2
3
def foo
puts 'foo'
end
Unfortunately this renders poorly in Minima as it becomes a table - the width must be reduced to not be 100% and there are borders must be removed:
Code:
<style>
.rouge-table {
width: initial;
}
table {
border: none;
}
table td {
border: none;
}
td pre {
border: none;
}
</style>