How does Pipedown work?

The goal of Pipedown is to extract codeblocks from Markdown and create a "pipeline" of functions. A pipeline will be familiar to anyone who has worked with data. "Piping" data through a sequence of (Extract Transform Load) steps until it is the desired shape.

Each codeblock will become a function, each codeblock will be triggered in the order they are written in the Markdown file. A plain old Javascript object ({}) is passed as an input argument to the first function and passed to each function in turn.

This simple mental model of piping data through a sequence of steps was the inspiration for Pipedown (surprise! 😆). For many years I have looked at web frameworks, command line apps, ETL and low/no-code tools and thought - "they are all the same".

The Pipedown core library is also written as a series of pipelines! Though they are handwritten, they are delightfully readable. Pipedown goes through a few steps to parse Markdown, extract the necessary information and output a Typescript module.

  1. Read markdown
    1. Extract codeblocks, lists and headings
  2. Convert to JSON
    1. If were the codeblocks are in a Markdown list, they might be special
  3. Write Javascript
Install Deno
Codeblocks -> JSON -> Typescript