Neovim 101 — Literate Programming
Literate programming is a methodology that combines a programming language with a documentation language, thereby making programs more robust, more portable, more easily maintained, and arguably more fun to write than programs that are written only in a high-level language.
In this article, we will use the Markdown language to write the documentation, and leverage Tree-sitter to generate the output of the code snippets.
This article is part of the Neovim 101 series.
The Neovim configuration files are available in this repository.
Writing Technical Documentation with Emacs
Writing technical documentation using Emacs Org mode.
The Markdown language is still the most widely used format for technical documentation. Using Neovim and Tree-sitter, we can easily generate the code output as part of the documentation.
Let’s use the Python language as an example.
In the screenshot below, we have a Markdown document with multiple Python code snippets. Using Tree-sitter, we can generate the code output easily from within Neovim, with less than 60 lines of code.
We introduced to you the basics of Tree-sitter in the previous article.
Tree-sitter has a Markdown parser. Using the
nvim-treesitter playground plugin, we create the…