Asciidoctor and/or Asciidoctor PDF need to be installed separately for the Cake addin to work. Please follow the official documentation for installation instructions:
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" />
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.
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.
Cake.Asciidoctor is licensed under the MIT License.
For details see https://github.com/ap0llo/Cake.Asciidoctor/blob/main/LICENSE
Building the project from source requires the .NET 7 SDK (version as specified in global.json) and uses Cake for the build.
To execute the default build, run
.\build.ps1
This will build the project, run all tests and pack the NuGet package.
The version of the addin is automatically derived from git and the information in version.json
using Nerdbank.GitVersioning:
-
The
main
branch always contains the latest version. Packages produced frommain
are always marked as pre-release versions (using the -pre suffix). -
Stable versions are built from release branches. Build from release branches will have no -pre suffix
-
Builds from any other branch will have both the -pre prerelease tag and the git commit hash included in the version string
To create a new release branch use the nbgv tool:
dotnet tool install --global nbgv
nbgv prepare-release