using Markdig;
using OliverBooth.Extensions.Markdig.Markdown.Callout;
using OliverBooth.Extensions.Markdig.Markdown.Template;
using OliverBooth.Extensions.Markdig.Services;
namespace OliverBooth.Extensions.Markdig;
///
/// Extension methods for .
///
public static class MarkdownPipelineExtensions
{
///
/// Enables the use of Obsidian-style callouts in this pipeline.
///
/// The Markdig markdown pipeline builder.
/// The modified Markdig markdown pipeline builder.
/// is .
public static MarkdownPipelineBuilder UseCallouts(this MarkdownPipelineBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
builder.Extensions.AddIfNotAlready();
return builder;
}
///
/// Enables the use of Wiki-style templates in this pipeline.
///
/// The Markdig markdown pipeline builder.
/// The template service responsible for fetching and rendering templates.
/// The modified Markdig markdown pipeline builder.
///
/// is .
/// -or-
/// is .
///
public static MarkdownPipelineBuilder UseTemplates(this MarkdownPipelineBuilder builder, ITemplateService templateService)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
if (templateService is null)
{
throw new ArgumentNullException(nameof(templateService));
}
builder.Use(new TemplateExtension(templateService));
return builder;
}
}