No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


What problem does this solve?

Allows you to embed source code, shell output, and various other features within a format agnostic document, some relation to

Project structure

A chapter file can reference one or more consecutive commits. / commit1
            / commit2
            / commit3 / commit4
            / commit5 / commit6
            / commit7

To modify a previuos chapter / fix a source code error, you would : git rebase, change the code, recompile and render - and that's it!

Diagram / demo illustratino:


Similar projects of potential interest

Supported tags / features:

{{ chapterHeader }} returns the text Chapter x where x is the chapter number.

{{ gitDiff path/to/ }} returns a git diff of file.

{{ file path/to/ }} returns the entire content of file.

{{ fileSection path/to/file.hs main }} like file but returns a section from a file (thanks to

{{ gitCommitOffset }} returns a special chapter's commit 'range'.

{{{{ shellOutput command goes here }}}} which would execute command goes here (in your shell) and output whatever is returned.

{{{ghci optionalSessionId
:t head

will run the code within a GHCi session and output the results (thanks to The optionalSessionId is a random string you can choose to 'persist' a GHCi process between tags.


  • Modifying old chapters requires doing a git rebase on that project - which may present some difficulty for the usual git collaberation (as you are basically rewriting git repo history). However changes can be shared by using additional git branches.
  • Not able to escape tags - so there may be issues if you use text tags like {{example}}.


stack install gitchapter:exe:gitchapter

How do I create a project that can be rendered?

Create a chapters directory in a git repository. Create a file with your relevant commits, where x is a 'chapter' number. You can then render a project by executing: gitchapter /path/to/project - this will generate a file from all the chapters.

Also using will allow you to generate HTML from markdown with a simple command like: pandoc --from markdown_strict+backtick_code_blocks -s -o compiled.html

Example 'GitChapter' projects:

Need help?

As this is a new project, if you hit any issues or need help setting anything up - please don't hesitate to post a Github issue! 😄