This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see Cake.MkDocs.
Summary
Run the builtin development server async.
- Assembly
- Cake
.MkDocs .dll - Namespace
- Cake
.MkDocs - Containing Type
- MkDocsAliases
Syntax
public static Task MkDocsServeAsync(this ICakeContext context, DirectoryPath projectDirectory, MkDocsServeAsyncSettings settings)
Examples
using (var tokenSource = new CancellationTokenSource())
{
var task = MkDocsServeAsync("./docs-project", new MkDocsServeAsyncSettings()
{
Token = tokenSource.Token
});
// Do work...
tokenSource.Cancel();
try
{
task.Wait();
}
catch (OperationCanceledException)
{
}
}
using (var tokenSource = new CancellationTokenSource())
{
var task = MkDocsServeAsync(new DirectoryPath("./docs-project"), new MkDocsServeAsyncSettings()
{
Token = tokenSource.Token
});
// Do work...
tokenSource.Cancel();
try
{
task.Wait();
}
catch (OperationCanceledException)
{
}
}
using (var tokenSource = new CancellationTokenSource())
{
var task = MkDocsServeAsync(new DirectoryPath("./docs-project"), new MkDocsServeAsyncSettings()
{
ToolTimeout = new TimeSpan(0, 0, 1, 0)
});
// Do work...
try
{
task.Wait();
}
catch (TimeoutException)
{
// Kill tool process after 1 minute
}
}
Remarks
This method will block build process. Use Ctrl+C
in console to quit
or use System.Threading.CancellationToken
to cancel task programmatically.
Attributes
Type | Description |
---|---|
Cake |
|
Cake |
|
Cake |
Parameters
Name | Type | Description |
---|---|---|
context | ICakeContext | The context. |
projectDirectory | DirectoryPath | Project directory path to serve. |
settings | Mk |
The settings. |
Return Value
Type | Description |
---|---|
Task | Long running task. |