using System.Collections.Generic;
using Spectre.Console.Internal;
using Spectre.Console.Rendering;
namespace Spectre.Console
{
///
/// A renderable piece of markup text.
///
public sealed class Markup : Renderable, IAlignable, IOverflowable
{
private readonly Paragraph _paragraph;
///
public Justify? Alignment
{
get => _paragraph.Alignment;
set => _paragraph.Alignment = value;
}
///
public Overflow? Overflow
{
get => _paragraph.Overflow;
set => _paragraph.Overflow = value;
}
///
/// Initializes a new instance of the class.
///
/// The markup text.
/// The style of the text.
public Markup(string text, Style? style = null)
{
_paragraph = MarkupParser.Parse(text, style);
}
///
protected override Measurement Measure(RenderContext context, int maxWidth)
{
return ((IRenderable)_paragraph).Measure(context, maxWidth);
}
///
protected override IEnumerable Render(RenderContext context, int maxWidth)
{
return ((IRenderable)_paragraph).Render(context, maxWidth);
}
}
}