using Markdig;
using Markdig.Parsers.Inlines;
using Markdig.Renderers;
using Markdig.Renderers.Html;
namespace OliverBooth.Extensions.Markdig.Markdown.Callout;
///
/// Extension for adding Obsidian-style callouts to a Markdown pipeline.
///
internal sealed class CalloutExtension : IMarkdownExtension
{
///
public void Setup(MarkdownPipelineBuilder pipeline)
{
var parser = pipeline.InlineParsers.Find();
if (parser is null)
{
pipeline.InlineParsers.InsertBefore(new CalloutInlineParser());
}
}
///
public void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer)
{
var blockRenderer = renderer.ObjectRenderers.FindExact();
if (blockRenderer is null)
{
renderer.ObjectRenderers.InsertBefore(new CalloutRenderer(pipeline));
}
}
}