package quill

  1. Overview
  2. Docs

Module Quill_projectSource

Notebook project model.

A project is a collection of notebooks, optionally organized by a config file. Without a config file, any directory of .md files is a valid project.

Types

Sourcetype notebook = {
  1. title : string;
  2. path : string;
}

A notebook reference. path is relative to the project root. Empty for placeholders.

Sourcetype toc_item =
  1. | Notebook of notebook * toc_item list
  2. | Section of string
  3. | Separator
    (*

    An entry in the table of contents. Notebook (nb, children) is a notebook with optional sub-entries. Section title introduces a named group. Separator is a visual break.

    *)
Sourcetype config = {
  1. title : string option;
  2. authors : string list;
  3. description : string option;
  4. output : string option;
  5. edit_url : string option;
}

Project configuration.

Sourcetype t = {
  1. title : string;
    (*

    Project title.

    *)
  2. root : string;
    (*

    Absolute path to the project directory.

    *)
  3. toc : toc_item list;
    (*

    Table of contents.

    *)
  4. config : config;
    (*

    Configuration.

    *)
}

A project.

Configuration

Sourceval default_config : config

Default configuration with all fields empty/none.

Sourceval parse_config : string -> (config * toc_item list, string) result

parse_config s parses a quill.conf file. Returns the configuration and table of contents entries.

Format: key = value lines for metadata, [Section Name] for groups, Title = path for notebooks (indentation creates nesting), --- for separators, # for comments.

Titles

Sourceval title_of_filename : string -> string

title_of_filename "01-intro.md" is "Intro". Strips the extension, strips leading digits and separators, replaces dashes and underscores with spaces, and capitalizes the first letter.

Queries

Sourceval notebooks : t -> notebook list

notebooks t is the flat, ordered list of all notebooks in t, excluding placeholders.

Sourceval all_notebooks : toc_item list -> notebook list

all_notebooks toc flattens toc into an ordered list of all notebooks, including placeholders.

Sourceval is_placeholder : notebook -> bool

is_placeholder nb is true iff nb has no file (empty path).

Sourceval prev_notebook : t -> notebook -> notebook option

prev_notebook t nb is the notebook before nb, or None.

Sourceval next_notebook : t -> notebook -> notebook option

next_notebook t nb is the notebook after nb, or None.

Sourceval number : toc_item list -> notebook -> int list

number toc nb is the section number of nb in toc, derived from its position. E.g. [1; 2] for the second entry in the first group. Returns [] if nb is not found.

Sourceval number_string : int list -> string

number_string [1; 2] is "1.2". Returns "" for [].