46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using ReportGeneration.Abstract;
|
|
using ReportGeneration.Interface;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace ReportGeneration.Generators;
|
|
|
|
public class MarkdownDocumentGenerator : DocumentGeneratorBase
|
|
{
|
|
/// <inheritdoc />
|
|
public MarkdownDocumentGenerator() { }
|
|
|
|
/// <inheritdoc />
|
|
public MarkdownDocumentGenerator(string filePath) : base(filePath) { }
|
|
|
|
/// <inheritdoc />
|
|
public MarkdownDocumentGenerator(Stream stream) : base(stream) { }
|
|
|
|
/// <inheritdoc />
|
|
public MarkdownDocumentGenerator(Stream stream, Encoding encoding) : base(stream, encoding) { }
|
|
|
|
#region Writing
|
|
|
|
/// <inheritdoc />
|
|
public override IDocumentGenerator AppendHeading(int level, string text) =>
|
|
AppendParagraph(new string('#', level) + ' ' + text);
|
|
|
|
/// <inheritdoc />
|
|
protected override ITableGenerator MakeTable(int columns, Stream stream) =>
|
|
new MarkdownTableGenerator(columns, stream);
|
|
|
|
/// <inheritdoc />
|
|
public override IDocumentGenerator AppendParagraph(string? text = default)
|
|
{
|
|
AppendLine(text);
|
|
AppendLine();
|
|
return this;
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <inheritdoc />
|
|
public override string FormatImage(string path, IBounds? bounds = default) =>
|
|
HtmlTools.FormatImage(path, default, bounds);
|
|
}
|