Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Octopress/Jekyll syntax highlighting: What are the advantages of ``` (backticks) vs. {% codeblock %} (liquid extensions), etc.?

I'm using Octopress for blogging, but I still haven't quite grasped the difference, if any, between "liquid extension"-style code blocks, using {% codeblock %}, and the more normal markdown-looking code blocks, using backticks, as well as the variations provided my kramdown and other markdown converters. That is:

{% codeblock haskell %}
main = putStrLn "Hello world"
-- liquid style
{% endcodeblock %}

vs.

```haskell
main = putStrLn "Hello world"
-- backtick fencing style (GitHub-flavored)
```

vs.

~~~ haskell
main = putStrLn "Hello world"
-- kramdown's tilde fencing
~~~

vs.

    main = putStrLn "Hello world"
    -- another kramdown style, I think
{:lang="haskell"}

etc.

Octopress provides the {% codeblock %} and backtick versions as "plugins", and they seem to support the same stuff: syntax highlighting, filenames for the code block, URL, etc.

I haven't gotten the kramdown-specific ones to work properly, I think because they depend on coderay or something, which I downloaded but couldn't get to work.

Anyway, here's my question:

Is there any reason to prefer one syntactic style over the other? On the one hand, I like the backtick fencing because it's GitHub-flavored markdown, which I'm used to and which seems "simpler", but on the other hand, the liquid syntax seems more "native" to Octopress.

Any thoughts would be much appreciated. At the moment, my posts have a random combination of styles, and I'd really like to streamline them into one style.

like image 515
Brian Buccola Avatar asked Mar 03 '13 21:03

Brian Buccola


1 Answers

{% codeblock haskell %}
main = putStrLn "Hello world"
-- liquid style
{% endcodeblock %}

requires Liquid

```haskell
main = putStrLn "Hello world"
-- backtick fencing style (GitHub-flavored)
```

is not "portable"

~~~ haskell
main = putStrLn "Hello world"
-- kramdown's tilde fencing
~~~

is my choice

    main = putStrLn "Hello world"
    -- another kramdown style, I think
{:lang="haskell"}

is outdated

like image 134
Zombo Avatar answered Oct 24 '22 09:10

Zombo