using Markdig;
using Markdig.Renderers;
using MfGames.Markdown.Gemtext.Renderers;
namespace MfGames.Markdown.Gemtext.Extensions
{
///
/// Extension method to turn all inline formatting from the default of
/// removing to render in normalizing in rendered form.
///
///
public class SetInlineFormatting : IMarkdownExtension
{
///
/// Gets or sets the override formatting for code lines
/// (backtick) spans.
///
public InlineFormatting? Code { get; set; }
///
/// Sets or sets the override formatting for all inlines.
///
public InlineFormatting? Default { get; set; }
///
/// Gets or sets the override formatting for emphasis (italic
/// and bold) spans.
///
public InlineFormatting? Emphasis { get; set; }
///
public void Setup(MarkdownPipelineBuilder pipeline)
{
}
///
public void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer)
{
if (renderer is not GemtextRenderer gemtext)
{
return;
}
gemtext.InlineFormatting = this.Default ?? gemtext.InlineFormatting;
gemtext.EmphasisFormatting = this.Emphasis;
gemtext.CodeFormatting = this.Code;
}
}
}