Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Spectre.Console.Cli" Version="0.53.1" />
<PackageReference Include="Spectre.Console.Cli" Version="0.55.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Spectre.Console.Testing" Version="0.54.0" />
<PackageReference Include="Spectre.Console.Testing" Version="0.55.0" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 10 additions & 1 deletion ConsoleMarkdownRenderer.Tests/RendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,16 @@ public IEnumerable<IRenderable> Process(RenderOptions options, IEnumerable<IRend
private bool Check(Segment segment)
{
Logger.LogMessage($"{segment.Style.ToMarkup()}:{segment.Text}");
return m_counts.ContainsKey(segment.Text) && m_style.Equals(segment.Style);
if (!m_counts.ContainsKey(segment.Text))
return false;
// Segment styles may include colors inherited from the rendering context (e.g. background).
// Only compare color components that were explicitly set in the expected style.
var seg = segment.Style;
if (m_style.Foreground != Color.Default && m_style.Foreground != seg.Foreground)
return false;
if (m_style.Background != Color.Default && m_style.Background != seg.Background)
return false;
return m_style.Decoration == seg.Decoration;
}

// Given a string create a dictionary where the keys are the words and the value is the number of items those words appear
Expand Down
2 changes: 1 addition & 1 deletion ConsoleMarkdownRenderer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<ItemGroup>
<PackageReference Include="Markdig" Version="1.1.2" />
<PackageReference Include="Spectre.Console" Version="0.54.0" />
<PackageReference Include="Spectre.Console" Version="0.55.0" />

<PackageReference Include="RomanNumeral" Version="2.0.0" />
<!--
Expand Down
1 change: 1 addition & 0 deletions ObjectRenderers/ConsoleObjectRenderers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Spectre.Console;

using Table = Markdig.Extensions.Tables.Table;
using TableCell = Markdig.Extensions.Tables.TableCell;
using TableRow = Markdig.Extensions.Tables.TableRow;

namespace ConsoleMarkdownRenderer.ObjectRenderers
Expand Down
2 changes: 1 addition & 1 deletion ObjectRenderers/ConsoleRendererBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override object Render(MarkdownObject markdownObject)

protected void NewFrameImplementation(Style? borderStyle = default)
{
borderStyle ??= Options.IncludeDebug ? Style.Plain : default;
borderStyle ??= Options.IncludeDebug ? Style.Plain : (Style?)null;
var frame = new Frame(borderStyle);
frame.Table.AddColumn(string.Empty);
PushFrame(frame);
Expand Down
6 changes: 3 additions & 3 deletions ObjectRenderers/Frames/ConsoleRendererBase.Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public Frame(Style? borderStyle = default)
Table = new Table()
.HideHeaders();

if (borderStyle == default)
if (borderStyle.HasValue)
{
Table.NoBorder();
Table.BorderStyle(borderStyle.Value);
}
else
{
Table.BorderStyle(borderStyle);
Table.NoBorder();
}
}

Expand Down
Loading