Skip to content
lsdocs

The protocol #

lsdocs talks to plugins with msgpack-rpc messages, each framed by a 4-byte length, over the plugin's standard input and output or a named pipe. The full specification is the wire protocol page (spec/wire.md in the lsdocs-protocol repository), with JSON Schemas for every message in schema/ (also served here, under schema/, and attached to its releases) and encoded examples in fixtures/.

Version #

The protocol is at 1.0-rc.1, a release candidate. A release candidate must match exactly, so plugins built against it are rebuilt for the next candidate and for 1.0. From 1.0 on, plugins and lsdocs work together when their major versions match: within a major version, changes only add fields and features older peers can ignore.

Methods #

MethodFromPurpose
initializelsdocsStarts the session: the project, the site and where its .config/ is in; protocol version, capabilities and the settings files read out.
initializedlsdocsNotification: phase requests follow.
parselsdocsA file's path and text in, a document out.
parse/transform/eachlsdocsA document in, any data read from it out; the document is not changed.
parse/transform/alllsdocsEverything read, once, before any document is changed; documents the plugin generates from it out.
render/transform/eachlsdocsA document in, the transformed document out.
renderlsdocsA document in, the output bytes out.
render/transform/alllsdocsThe rendered pages in, files no single page makes out (a sitemap).
host/parsepluginText and a file extension in (optionally a parser's name, a fragment context and where the text comes from), the document or fragment that parser makes out.
shutdown, exitlsdocsEnds the session.
log, progress, diagnosticspluginNotifications at any time.
$/canceleitherCancels a request.

Capabilities #

CapabilitySays
parse.extensionsThe file extensions the plugin parses.
transform.nodesThe node kinds it looks at; documents without any are not sent.
transform.eachWhether it wants parse/transform/each (and parse/transform/all).
render.formatsThe output formats it writes.
render.allWhether it wants render/transform/all.
max_concurrencyHow many requests it handles at once.
cacheThat its results may be cached, and a key for any other input.
syntaxThe directives and roles it handles. lsdocs passes them to parsers, which make custom nodes of them for the plugin (see "Syntax extensions" in the specification).