Crate tpnote_lib

source ·
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).

Tp-Note’s high-level API, c.f. module workflow, abstracts most implementation details. Roughly speaking, the input path correspond to Tp-Note’s first positional command line parameter and the output path is the same that is printed to stdout after usage. The main consumer of tpnote-lib’s high-level API is the module workflow in tp-note crate.

Modules

Set configuration defaults, reads and writes Tp-Note’s configuration file and exposes the configuration as static variable behind a mutex. This makes it possible to modify all configuration defaults (and templates) at runtime.
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 dealing with filenames.
Syntax highlighting for (inline) source code blocks in Markdown input.
Helper functions dealing with HTML conversion.
Helper functions dealing with markup languages.
Abstractions for content templates and filename templates.
Tp-Note’s high level API.

Macros

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