rs-rich-plugin-api 0.0.1

The plugin contract for the `rich` Rust port: register highlighters, themes, box styles and renderers
Documentation

rs-rich-plugin-api

The plugin contract for rs-rich, the Rust port of Python's rich.

A plugin is a type that implements [Plugin]: it describes itself with PluginMetadata and registers what it adds through a PluginRegistrar:

  • regex highlighters, applied to printed text;
  • code highlighters (rich::CodeHighlighter), selectable by name;
  • named themes and box styles;
  • named source renderers, which turn text (a diagram, a data file) into a renderable;
  • renderers for Markdown code fences of a given language;
  • named text transforms (TextTransform), which a host chains into a pipeline.

This crate depends only on rs-rich. A plugin never depends on rs-rich-ext, which is where plugins are hosted:

let mut registry = rich_ext::ExtensionRegistry::with_defaults();
registry.add_plugin(&my_plugin::MyPlugin)?;
registry.install(&mut console);

Registration is explicit. There is no auto-discovery and no dynamic loading. Each plugin declares the PLUGIN_API_VERSION it was built for, and the host refuses a plugin built for a different one.

The API is at 0.0.x and still moving. See the plugin guide.