lsdocs_config #
Project configuration (lsdocs.toml) and plugin manifest types.
ConfigFile mirrors lsdocs.toml as written. Config::from_toml
parses and validates it into a Config, reporting every problem at once.
Overrides then layer environment variables and CLI flags on top:
let mut config = from_toml.unwrap;
config.apply;
config.apply;
assert_eq!;
This crate does no I/O; the caller reads the file and passes the environment in.
type alias Value #
pub type Value = Value;An arbitrary structured value.
constant DEFAULT_SOURCE_DIR #
pub const DEFAULT_SOURCE_DIR: &str = "docs";Default for Config::source_dir.
constant DEFAULT_OUTPUT_DIR #
pub const DEFAULT_OUTPUT_DIR: &str = "site";Default for Config::output_dir.
struct ConfigFile #
The contents of lsdocs.toml, as written. Unknown keys are rejected so
typos are caught.
Trait implementations
DebugCloneDefaultStructuralPartialEqPartialEqSerializeDeserialize<'de>(impl<'de>)
field site #
pub site: SiteSectionThe [site] settings: what the website is (title, base URL).
field build #
pub build: BuildSectionBuild settings.
field plugins #
pub plugins: Plugins, in pipeline order within each phase.
struct SiteSection #
The [site] table.
Trait implementations
DebugCloneDefaultStructuralPartialEqPartialEqSerializeDeserialize<'de>(impl<'de>)
field title #
pub title: Site title.
field base_url #
pub base_url: URL or path prefix the site is served from, e.g. "/docs/".
field theme #
pub theme: No longer supported, and an error: the theme is chosen in the
HTML renderer's settings (theme in render-html's
.config/lsdocs/<name>/settings.toml). Kept so the error can say so.
struct BuildSection #
The [build] table.
Trait implementations
DebugCloneDefaultStructuralPartialEqPartialEqSerializeDeserialize<'de>(impl<'de>)
field source_dir #
pub source_dir: Directory holding source documents. Defaults to "docs".
field output_dir #
pub output_dir: Directory the output is written to. Defaults to "site".
struct PluginEntry #
One [[plugins]] entry. Exactly one of builtin, command or runtime
says how to run the plugin.
Trait implementations
DebugCloneDefaultStructuralPartialEqPartialEqSerializeDeserialize<'de>(impl<'de>)
field name #
pub name: StringUnique name used in logs and diagnostics.
field builtin #
pub builtin: Name of a first-party plugin to run in-process, e.g.
"parser-myst".
field command #
pub command: Program and arguments to launch.
field runtime #
pub runtime: Runtime to launch a script plugin with; needs module (Python) or
entry (Node).
field module #
pub module: Python module to run with python -m.
field entry #
pub entry: Node.js entry script.
field transport #
pub transport: How to talk to an out-of-process plugin. Defaults to "stdio".
field files #
pub files: Glob patterns limiting which source files this plugin handles.
field options #
pub options: No longer supported, and an error: a plugin's settings are its own
files under .config/, next to lsdocs.toml. Kept so the error
can say so.
enum Runtime #
Runtime for script plugins.
Trait implementations
DebugCloneCopyStructuralPartialEqPartialEqEqSerializeDeserialize<'de>(impl<'de>)
variant Python #
PythonRun with python -m <module>.
variant Node #
NodeRun with node <entry>.
enum Transport #
Transport for out-of-process plugins.
Trait implementations
DebugCloneCopyDefaultStructuralPartialEqPartialEqEqSerializeDeserialize<'de>(impl<'de>)
variant Stdio #
StdioThe plugin's stdin and stdout.
variant Pipe #
PipeA named pipe (Windows) or unix socket whose path is passed to the
plugin in the LSDOCS_PIPE environment variable.
struct Config #
Validated project configuration.
Trait implementations
field title #
pub title: Site title.
field base_url #
pub base_url: URL or path prefix the site is served from.
field source_dir #
pub source_dir: StringDirectory holding source documents, relative to the config file.
field output_dir #
pub output_dir: StringDirectory the output is written to, relative to the config file.
field plugins #
pub plugins: Plugins, in the order they were declared.
function from_toml #
Parses and validates the contents of lsdocs.toml.
function from_file #
Validates an already-parsed config file.
method apply #
Applies overrides on top of this configuration. Call once per layer, lowest priority first (environment, then CLI).
struct Plugin #
A validated plugin entry.
Trait implementations
field name #
pub name: StringUnique name.
field launch #
pub launch: LaunchHow the plugin is run.
field files #
pub files: Glob patterns limiting which source files this plugin handles; empty means no limit beyond the plugin's own capabilities.
enum Launch #
How a plugin is run.
Trait implementations
variant Builtin #
Builtin A first-party plugin linked into the host and run in-process.
field name #
name: StringFirst-party plugin name.
variant External #
External A separate process.
field command #
command: CommandWhat to launch.
field transport #
transport: TransportHow to talk to it.
enum Command #
What to launch for an out-of-process plugin.
Trait implementations
variant Program #
Program A program and its arguments.
field program #
program: StringProgram name or path.
field args #
args: Arguments.
variant Python #
Python python -m <module>.
field module #
module: StringModule name.
variant Node #
Node node <entry>.
field entry #
entry: StringEntry script path.
struct Overrides #
Settings that can be overridden by environment variables or CLI flags.
Trait implementations
field source_dir #
pub source_dir: Overrides Config::source_dir (LSDOCS_SOURCE_DIR).
field output_dir #
pub output_dir: Overrides Config::output_dir (LSDOCS_OUTPUT_DIR).
field base_url #
pub base_url: Overrides Config::base_url (LSDOCS_BASE_URL).
function from_env #
Reads overrides from LSDOCS_* variables. Pass std::env::vars().
enum ConfigError #
Why a configuration could not be loaded.
Trait implementations
variant Syntax #
SyntaxThe file is not valid TOML, or does not match the expected shape (including unknown keys). Holds the parser's message.
variant Invalid #
InvalidThe file parsed but has one or more invalid settings.
struct Problem #
One invalid setting.
Trait implementations
field at #
pub at: StringWhere the problem is, e.g. plugins[2].
field message #
pub message: StringWhat is wrong.