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). While LIB_CFG is sourced only once at the start of Tp-Note, the SETTINGS may be sourced more often. The latter contains configuration data originating form environment variables.

Tp-Note’s high-level API, cf. 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 and html_renderer in the tpnote crate.

Modules§

clone_ext
Extension trait adding a shallow_clone() method to Cow.
config
Set configuration defaults by reading the internal default configuration file LIB_CONFIG_DEFAULT_TOML. After processing, the configuration data is exposed via the variable LIB_CFG behind a mutex. This makes it possible to modify all configuration defaults (including templates) at runtime.
content
Self referencing data structures to store the note’s content as a raw string.
context
Extends the built-in Tera filters.
error
Custom error types.
filename
Helper functions dealing with filenames.
highlight
Syntax highlighting for (inline) source code blocks in Markdown input.
html
Helper functions dealing with HTML conversion.
html2md
This module abstracts the HTML to Markdown filter.
html_renderer
Tp-Note’s high level HTML rendering API.
markup_language
Helper functions dealing with markup languages.
settings
Configuration data that origins from environment variables. Unlike the configuration data in LIB_CFG which is sourced only once when Tp-Note is launched, the SETTINGS object may be sourced more often in order to follow changes in the related environment variables.
template
Abstractions for content templates and filename templates.
workflow
Tp-Note’s high level API.

Macros§

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