how to write code blocks using maruku

1k Views Asked by At

how can i write code blocks in maruku for ruby,javascript

currently i am using technique. but my first line moving to left.

hash["test"] = "test"
hash.merge!("test" => "test")
h=HashWithIndifferentAccess.new
h.update(:test => "test")

{:lang=ruby html_use_syntax=true}

2

There are 2 best solutions below

1
On BEST ANSWER

I'm not sure I fully understand the question, but Maruku is just a Markdown interpreter.

To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab. For example, given this input:

This is a normal paragraph:

    This is a code block.

Markdown will generate:

<p>This is a normal paragraph:</p>

<pre><code>This is a code block.
</code></pre>
0
On

I add this answer because I ended up here searching for a solution to code blocks with Maruku using Jekyll. For anyone else in the same boat, use the Liquid tags for code blocks instead of the Markdown syntax:

{% highlight java %}  
System.out.println("Hello, Maruku.");  
{% endhighlight %}  

Also see this question/answer: Highlight with Jekyll and pygments doesn't work