Minimal Theme
Desired Persona
Affiliate marketer. Media buyer. Developer.
· Less than 1 min read

Post with codeblocks

This is how to add codeblocks to your posts

Codeblocks

Input:

``` ruby
def show
  @widget = Widget(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @widget }
  end
end
```

Output:

def show
  @widget = Widget(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @widget }
  end
end

Codeblocks with line numbers

Input:

{% highlight ruby linenos %}
def show
  @widget = Widget(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @widget }
  end
end
{% endhighlight %}

Output:

1
2
3
4
5
6
7
def show
  @widget = Widget(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @widget }
  end
end

Command line prompt

Input:

{% highlight shell %}
$ gem install jekyll
{% endhighlight %}

Output:

$ gem install jekyll

Code in a paragraph

Input:

This is what `<html>` code looks like in a paragraph of text.

Output:

This is what <html> code looks like in a paragraph of text.