Hexo Codeblock Highlighting Verses Markdown

This is a simple post to see if there are any differences in the style of code when defined in a { % codeblock % } or using markdown notation (tripple backticks / indentation). In this case I am just using some simple Clojure code.

Showing code by indentation

I have wrapped the following lines by three backtick characters on the line before and line after the code. These tripple backtick characters to instruct the Hexo markdown processor that the containing lines should be rendered as a code block.

really-simple-example.clj
1
2
(defn clojure-function [paramter]
(str "Lets do something simple using Clojure and " parameter))

That should be a simple Clojure example using markdown indentation.

Using Hexo Codeblock

Hexo has several plugin types from Swig that you can use in your post. Lets try out codeblock to see if there is any difference in how it renders compared to the above markdown.

basic-clojure-example.clj
1
2
3
4
5
6
(def authors [:name "John Stevenson"])

(defn show-author [authors]
(str authors))

(show-author authors)

The rendering of both pieces of code is pretty much the same, except with the code block I added language and a title. If I use three backticks then I can specify the language and a filename that contains the code. If I just use indentation, specifying a language and filename is not possible (as far as I know).

Thank you.
@jr0cket


This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket
Creative Commons License