My random notes for Nim lang

kaushalmodi
Sat, 19 May 2018 12:23:50 +0000

-> Nim notes <-

Some background

I am learning a new programming language Nim. As many would do, I also take my own notes as I am learning it, running little example by myself, etc.

.. but I doing that a bit differently.

I take notes in Emacs Org mode. Org mode has a feature set called Org Babel. That allows one to document the code snippets, and also run them directly in that document, and insert their output results below them -- Notes in Org

This also helps me document regression of the language behavior between different Nim versions of any, as the exact outputs are documented too. After each major Nim update, I press a single binding (C-v C-v b) in Emacs, and all the output blocks get recalculated.

But not everyone uses Emacs and Org mode. So to be able to share them to a wider audience, I need to export (Org term) that to a format like HTML, PDF, or Markdown..

Hugo is a really fast static site generator that uses Markdown as one of the primary content formats. It parses that to HTML using a Go Markdown library called Blackfriday.

As my notes are in Org mode, and converting them to HTML via Hugo needs them to be in Blackfriday compatible Markdown (which is almost like GitHub flavored Markdown), I starting working on an Emacs Org mode package ox-hugo about a year back. Using that, this Markdown file is generated. Hugo natively supports a subset of Org, but I needed to write this package to use the full power of Org mode.

Hugo then takes that Markdown and generates the final Nim notes page in HTML.

In the end, I have something that ties together all things of my interest: Nim, Emacs, Org mode and Hugo :)

Comments URL: https://tildes.net/~comp/hc/my_random_notes_for_nim_lang

Votes: 8

Comments: 11