oliverbooth.dev/OliverBooth/Markdown/Template/TemplateRenderer.cs

29 lines
904 B
C#
Raw Normal View History

2023-08-11 14:51:20 +00:00
using Markdig.Renderers;
using Markdig.Renderers.Html;
using OliverBooth.Services;
namespace OliverBooth.Markdown.Template;
/// <summary>
/// Represents a Markdown object renderer that handles <see cref="TemplateInline" /> elements.
/// </summary>
internal sealed class TemplateRenderer : HtmlObjectRenderer<TemplateInline>
{
private readonly ITemplateService _templateService;
/// <summary>
/// Initializes a new instance of the <see cref="TemplateRenderer" /> class.
/// </summary>
/// <param name="templateService">The <see cref="TemplateService" />.</param>
public TemplateRenderer(ITemplateService templateService)
{
_templateService = templateService;
}
/// <inheritdoc />
protected override void Write(HtmlRenderer renderer, TemplateInline template)
{
2023-08-13 17:02:19 +00:00
renderer.Write(_templateService.RenderGlobalTemplate(template));
}
}