Patrik Svensson 93ec7401c8 Add support for markdown tables
Closes #85

* Split Border into BoxBorder and TableBorder
* Change how different table parts are composed
* Add markdown table border
2020-10-01 14:43:08 +02:00

41 lines
1.6 KiB
C#

using System;
namespace Spectre.Console.Rendering
{
/// <summary>
/// Represents a border with a heavy header.
/// </summary>
public sealed class HeavyHeadTableBorder : TableBorder
{
/// <inheritdoc/>
public override TableBorder? SafeBorder => TableBorder.Square;
/// <inheritdoc/>
protected override string GetBorderPart(TableBorderPart part)
{
return part switch
{
TableBorderPart.HeaderTopLeft => "┏",
TableBorderPart.HeaderTop => "━",
TableBorderPart.HeaderTopSeparator => "┳",
TableBorderPart.HeaderTopRight => "┓",
TableBorderPart.HeaderLeft => "┃",
TableBorderPart.HeaderSeparator => "┃",
TableBorderPart.HeaderRight => "┃",
TableBorderPart.HeaderBottomLeft => "┡",
TableBorderPart.HeaderBottom => "━",
TableBorderPart.HeaderBottomSeparator => "╇",
TableBorderPart.HeaderBottomRight => "┩",
TableBorderPart.CellLeft => "│",
TableBorderPart.CellSeparator => "│",
TableBorderPart.CellRight => "│",
TableBorderPart.FooterBottomLeft => "└",
TableBorderPart.FooterBottom => "─",
TableBorderPart.FooterBottomSeparator => "┴",
TableBorderPart.FooterBottomRight => "┘",
_ => throw new InvalidOperationException("Unknown border part."),
};
}
}
}