Expand description

The tpnote-lib library is designed to embed Tp-Note’s core function in common text editors and text editor plugins. It is dealing with templates and input files and is also part of the command line application Tp-Note. This library also provides a default configuration in the static variable LIB_CFG that can be customized at runtime. The defaults for the variables grouped in LIB_CFG, are defined as constants in the module config (see Rustdoc).

This heart of this API is the module note. Everything else is designed around. In note you will find some Rustdoc tests illustrating the usage of this API. Most other modules :ware not called directly and might change to private in the future.

The main consumer of this API is the module workflow in the crate tpnote. In addition to the above-mentioned Rustdoc tests, the source code of workflow showcases its usage the best.

Modules

Set configuration defaults, reads and writes Tp-Note’s configuration file and exposes the configuration as static variable behind a mutex.
Self referencing data structures to store the note’s content as a raw string.
Extends the built-in Tera filters.
Custom error types.
Helper functions that deal with filenames.
Extends the built-in Tera filters.
Creates a memory representation of the note’s YAML header. In this documentation, the terms “YAML header”, ”header” and ”front matter“ are used as synonyms for the note’s meta data block at the beginning of the text file. Technically this is a wrapper around a tera::Map.
Creates a memory representation of the note by inserting Tp-Note’s environment data in some templates. If the note exists on disk already, the memory representation is established be reading the note file with its front matter.
Abstractions for content templates and filename templates.

Macros

Macro to construct a NoteError::TeraTemplate from a Tera::Error` .