Skip to main content
net6.0net7.0

Cake addin for Asciidoctor and Asciidoctor PDF

Published
Aug 25, 2023
3y ago
Total Downloads
1.7K
1,733

Install

dotnet add package Cake.Asciidoctor --version 1.0.31
ProductVersions
.NET
net6.0net7.0

README

Cake.Asciidoctor

Cake.Asciidoctor is a Cake Addin that provides aliases for Asciidoctor and Asciidoctor PDF

You can read the latest documentation at https://github.com/ap0llo/Cake.Asciidoctor.

Table of Contents

Prerequisites

Asciidoctor and/or Asciidoctor PDF need to be installed separately for the Cake addin to work.
Please follow the official documentation for installation instructions:

Usage

Install the Addin

Install the addin into your Cake build.

  • If you are using Cake scripting, use the #addin reprocessor directive:

    #addin nuget:?package=Cake.Asciidoctor&version=VERSION
    
  • If you are using Cake.Frosting, install the addin by adding a package reference to your project:

    <PackageReference Include="Cake.Asciidoctor" Version="VERSION" /> 
    

Converting an AsciiDoc document to HTML

The Asciidoctor() alias runs Asciidoctor to convert an AsciiDoc document to HTML.

The only required parameter is the path of the input document. This will convert the document to HTML and place it next to the input document:

Task("ConvertDocuments").Does(() =>
{
    // This will create "input.html" in the same directory as input.adoc
    Asciidoctor("input.adoc");
});

Additional (optional) settings can be specified using the AsciidoctorSettings parameter.

For example, to change the output directory, use the DestinationDirectory property:

Task("ConvertDocuments").Does(() =>
{
    Asciidoctor(
        "input.adoc",
        new AsciidoctorSettings() 
        {
            DestinationDirectory = "./output-directory"
        });
});

The avaialble options in AsciidoctorSettings correspond to the command line options of Asciidoctor. Please refer to asciidoctor(1) for detailed information.

Converting an AsciiDoc document to PDF

The AsciidoctorPdf() alias runs Asciidoctor PDF to convert an AsciiDoc document to PDF.

The only required parameter is the path of the input document. This will convert the document to a PDF and place it next to the input document:

Task("ConvertDocuments").Does(() =>
{
    // This will create "input.html" in the same directory as input.adoc
    AsciidoctorPdf("input.adoc");
});

Additional (optional) settings can be specified using the AsciidoctorPdfSettings parameter.

For example, to change the output directory, use the DestinationDirectory property:

Task("ConvertDocuments").Does(() =>
{
    AsciidoctorPdf(
        "input.adoc",
        new AsciidoctorPdfSettings() 
        {
            DestinationDirectory = "./output-directory"
        });
});

The available options in AsciidoctorPdfSettings correspond to the command line options of Asciidoctor PDF and are mostly the same as the options of Asciidoctor. Please refer to the Asciidoctor PDF documentation for details.

License

Cake.Asciidoctor is licensed under the MIT License.

For details see https://github.com/ap0llo/Cake.Asciidoctor/blob/main/LICENSE

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.