Hello,
I tried 5 combination for code blocks in qubes doc out.
The github flavored markdown (GFM) code block extension is not possible:
```
code comes here
```
because the current qubes-doc configuration [1] uses kramdown and pygments.
The fenced code block can be used with an additional setting in the configuration file:
->
q-doc-kramdown-gfm.pngStandard markdown uses four spaces of indention or eight in an list.
-> q-doc-markdown.png - shows a markdown code block in a list.
Markdown code blocks don't offer syntax highlighting.
Kramdown itself has a fenced code block syntax [2], but it is different from GFM:
~~~
code comes here
~~~
-> kramdown-block.png result of the above code
The kramdown fenced code block syntax allows to specific a programming language for syntax highlighting:
~~~ bash
code comes here
~~~
->
q-doc-kramdown-block-lang.pngthis only works with the KramdownPygments plugin [3]:
->
q-doc-KramdownPygments.pngbut the plugin has to be installed and configured.
Another option to highlight code blocks is to use pygments:
{% highlight bash %}
code comes here
{% endhighlight %}
this works fine:
q-doc-kramdown-pygments.png
but is not perfect with intended code blocks:
-> q-doc-kramdown-pygments-wrong.pngHere is my not completely objective pro/contra summary:
Markdown:
---------------
Pro:
+ Least common denominator
Con:
- No, syntax highlighting
- Based on indention (easy to make a mistake)
- Hard to find with automatic scripts
Kramdown:
----------------
Pro:
+ easy to write with US and European keyboard layouts
+ visible difference between code and text
Con:
+ No, syntax highlighting
KramdownPygments:
-------------------------------
Pro:
+ see Kramdown
+ synatx highlightning
Con:
- Extra plugin needed
- Configuration needs to be changed
Pygments:
----------------
Pro:
+ syntax highlighting
Con:
+ ugly in text
There are many options, but what is the best options?
[1]
https://github.com/QubesOS/qubesos.github.io/blob/12dc47618b0bc4e20bf52dc31ff08223a3693486/_config.yml#L23[2]
http://kramdown.gettalong.org/syntax.html#code-blocks[3]
https://github.com/mvdbos/kramdown-with-pygmentsBest regards
J. Eppler