Skip to content

Drive the publisher from Perl ​

The MakeMaker and command-line entry points are conveniences. A script can construct the selected backend and dispatch the same actions directly.

perl
use strict;
use warnings;
use Markdown::Publish;

my $publish_or=Markdown::Publish->new({
    module  => 'starlight',
    name    => 'Example::Client',
    sources => ['doc'],
    output  => 'site',
});

my $site_dn=$publish_or->run('build');

To read a project file, call Markdown::Publish->load_config() or pass only config_file to the base constructor.

perl
my $publish_or=
    Markdown::Publish->load_config('doc/project.json');
$publish_or->run('serve');

Backend constructors are also available when the engine is already known. The supported actions are build, serve, gh, gh-push, and cloudflare.