mrdocs::PluginContext::registerGenerator

registerGenerator overloads

Synopses

Declared in <mrdocs/Plugin.hpp>

Register a generator.

virtual
Expected<void>
registerGenerator(std::unique_ptr<Generator> G) = 0;

Register a generator from an id and a callable.

template<class F>
requires std::copy_constructible<std::decay_t<F>> &&
        std::is_invocable_r_v<
            Expected<void>,
            std::decay_t<F>&,
            GeneratorExtensionContext const&>
Expected<void>
registerGenerator(
    std::string_view id,
    F&& fn,
    std::string_view displayName = {},
    std::string_view fileExtension = {});

Return Value

  • An error if the generator is null, or if one with the same id is already registered.

  • An error if a generator with the same id is already registered.

Parameters

Name

Description

G

The generator to register. Ownership is transferred to MrDocs, which keeps it while a registry or the library registry holds it. The library stays loaded for the rest of the process.

id

The generator's id.

fn

A callable taking a GeneratorExtensionContext const& and returning Expected<void>.

displayName

The generator's display name; id when empty.

fileExtension

The generator's file extension, without a leading period; empty by default.

Created with MrDocs