package indentation_buffer

  1. Overview
  2. Docs
A library for building strings with indentation

Install

Dune Dependency

Authors

Maintainers

Sources

indentation_buffer-v0.16.0.tar.gz
sha256=1ac71d3dfd82d264260519e92d04429f99a9209477c22bc9ff655f7787a801a0

doc/indentation_buffer/Indentation_buffer/index.html

Module Indentation_bufferSource

Sourcetype t

A buffer that keeps track of the current indentation level. It abstracts the need for formatting code to thread the current indentation everywhere, and also ensures that blank lines do not accidentally get filled with the current indentation, thus yielding trailing whitespace in the output.

Sourceval string : t -> string -> unit

Appends the input string to a buffer. If the buffer is at the start of a new line, then the current indentation is inserted.

Sourceval newline : t -> unit

Starts a new line in the buffer, but does not append any indentation. This will only happen if a string is appended before the buffer moves to the next line.

Sourceval indent : t -> unit

Increase the current indentation by one level.

Sourceval dedent : t -> unit

Decrease the current indentation by one level.

Sourceval create : int -> t

Create a new buffer with the specified initial capacity.

Sourceval contents : t -> string

Retrieve the contents of the buffer as a string.

OCaml

Innovation. Community. Security.