package asai

  1. Overview
  2. Docs

The definition of highlighted text suitable for rendering. You probably do not need this module unless you want to create your own backend.

Types

type ('a, 'style) styled = {
  1. style : 'style;
  2. value : 'a;
}

A styled value is a value with a style.

type 'style segment = (string, 'style) styled

A segment is a styled string from the user content.

type 'style line = 'style segment list

A line is a list of segments.

type 'style block = {
  1. start_line_num : int;
    (*

    The starting 1-indexed line number of a block.

    *)
  2. lines : 'style line list;
    (*

    The lines within a block.

    *)
}

A block is a collection of consecutive lines.

type 'style part = {
  1. file_path : string;
    (*

    The file path of a part.

    *)
  2. blocks : 'style block list;
    (*

    The blocks within a part.

    *)
}

A part consists of multiple blocks from the same file. These blocks should be non-overlapping and sorted by importance or the textual order.

type 'style t = 'style part list

Highlighted texts instead of spans.

Helper Functions

val style : 'style -> 'value -> ('value, 'style) styled

Debugging

val dump : (Stdlib.Format.formatter -> 'style -> unit) -> Stdlib.Format.formatter -> 'style t -> unit

Ugly printer for debugging

OCaml

Innovation. Community. Security.