@lsdocs/plugin #
interface Span #
A byte range in the source text (end exclusive).
property start #
start: numberproperty end #
end: numbertype alias Node #
A node in the document tree, tagged by type.
interface LinkTarget #
Where a cross-reference link points inside the site: a document (source
path) and/or an anchor, or an unresolved label.
property document #
document?: stringproperty anchor #
anchor?: stringproperty label #
label?: stringinterface Document #
A parsed source document.
property source #
source: stringproperty metadata #
metadata?: Record<string, unknown>property children #
children: Nodeinterface Diagnostic #
property severity #
severity: 'error' | 'warning' | 'info' | 'hint'property message #
message: stringproperty source #
source?: stringproperty span #
span?: Spanproperty code #
code?: stringinterface ProjectInfo #
The project being built.
property root #
root?: stringAbsolute path of the project directory; resolve option paths against it.
property source_dir #
source_dir?: stringAbsolute path of the source directory, which document sources are relative to.
property files #
files?: stringEvery source file (documents and assets), relative to the source directory, sorted.
interface SiteInfo #
The site the project renders to.
property title #
title?: stringproperty base_url #
base_url?: stringinterface Context #
What a handler receives alongside its params.
property project #
readonly project: ProjectInfoproperty site #
readonly site: SiteInfoproperty settings #
readonly settings: Record<string, string | null> | nullThe plugin's settings: each of its configFiles ({name} resolved)
mapped to its text, or null if missing.
property config #
readonly config: dir (the project's .config/) and name (the plugin's name in the project config).
method log #
level: 'error' | 'warn' | 'info' | 'debug' | 'trace', message: string: voidmethod debug #
message: string: voidmethod info #
message: string: voidmethod warn #
message: string: voidmethod progress #
message: string, percentage?: number: voidmethod diagnostic #
diagnostic: Diagnostic: voidinterface ParseParams #
property source #
source: stringproperty text #
text: stringproperty fragment #
fragment?:Present when text is a piece of a document: return its nodes as document.children.
property origin #
origin?:Where text really comes from, for diagnostics: its file and byte offset in it.
interface ParseResult #
property document #
document: Documentproperty diagnostics #
diagnostics?: Diagnosticinterface ReadParams #
property document #
document: Documentinterface ReadResult #
property data #
data: unknownproperty diagnostics #
diagnostics?: Diagnosticinterface ApplyParams #
property document #
document: Documentproperty collected #
collected: Record<string, unknown> | nullCollected data from every document, keyed by source; null without parse/transform/each.
interface ApplyResult #
property document #
document: Documentproperty diagnostics #
diagnostics?: Diagnosticinterface RenderParams #
property document #
document: Documentproperty format #
format: stringinterface RenderResult #
property output #
output: string | Uint8Arrayproperty extension #
extension?: stringproperty diagnostics #
diagnostics?: Diagnosticproperty data #
data?: unknownData about the page, handed back in renderAll's pages (cached with the page).
interface RenderedPage #
A page written by the render phase.
property source #
source: stringproperty path #
path: stringOutput path, relative to the output directory.
property metadata #
metadata?: Record<string, unknown>property data #
data?: unknownThe data its render returned, if any.
interface RenderAllParams #
property format #
format: stringproperty pages #
pages: RenderedPageinterface OutputFile #
A file no single page makes, to write, e.g. a sitemap.
property path #
path: stringproperty output #
output: string | Uint8Arrayinterface RenderAllResult #
property files #
files?: OutputFileproperty diagnostics #
diagnostics?: Diagnosticinterface PluginDefinition #
A plugin's definition. Each phase is optional.
property name #
name: stringproperty version #
version?: stringproperty maxConcurrency #
maxConcurrency?: numberRequests handled at once (default 1).
property configFiles #
configFiles?: stringThe files the plugin reads its settings from, relative to .config/,
{name} standing for its name in the site config (lsdocs' own plugins
use lsdocs/{name}/settings.toml). Read when the session starts.
property parse #
parse?:property read #
read?: | Handler<ReadParams, ReadResult | unknown> | property transform #
transform?: | Handler<ApplyParams, ApplyResult | Document> | property render #
render?:property renderAll #
renderAll?: | Handler<RenderAllParams, RenderAllResult | OutputFile> | Called once after every page is rendered; returns files no single page makes (or
just the list of them). Needs render.
interface Capabilities #
property parse #
parse?:property transform #
transform?:property render #
render?:property max_concurrency #
max_concurrency?: numberproperty cache #
cache?: stringclass Plugin #
constructor constructor #
definition: PluginDefinitionfield name #
readonly name: stringfield version #
readonly version: stringfield capabilities #
readonly capabilities: Capabilitiesmethod serve #
: Promise<void>Runs the plugin until the host is done with it.
function definePlugin #
constant PROTOCOL_VERSION #
Protocol version spoken by this package.