Skip to main content

Ralsina.Me — Roberto Alsina's website

New Nikola Feature: code listings

This is a new fea­ture in Niko­la, my stat­ic web­site and blog gen­er­a­tor.

It's aimed at show­ing pieces of files in the post­s, and giv­ing you a link to the full file, does rea­son­able syn­tax high­light thanks to pyg­ments, and the syn­tax for em­bed­ding in your posts is not ex­ces­sive­ly aw­ful, so I can use it for some of my tu­to­ri­al / book project­s.

Here's an ex­am­ple:

.. listing:: md.py python
   :start-at: def compile_html
   :end-before: output =

Sys­tem Mes­sage: ER­ROR/3 (<string>, line 14)

Er­ror in "list­ing" di­rec­tive: un­known op­tion: "s­tart-at".

.. listing:: md.py python
    :start-at: def compile_html
    :end-before: output =

This is not merged in­to mas­ter yet, but should be soon.