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
14 changes: 0 additions & 14 deletions ConsoleMarkdownRenderer.Tests/RendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,20 +590,6 @@ public void RendererTests_AbbreviationTitleTest(bool useCrazy)
AssertMarkdownYieldsFormat("abbreviation", "World Wide Web Consortium", new Style(decoration: Decoration.Dim), useCrazy);
}

[TestMethod]
public void RendererTests_AbbreviationTitleSuppressed()
{
// With ShowAbbreviationTitle = false the expansion is not emitted at all
var options = new DisplayOptions { IncludeDebug = true, ShowAbbreviationTitle = false };
ConsoleUnderTest.Write(Renderer(GetResourceContent("abbreviation", "md"), options));

var output = ConsoleUnderTest.Output;
Assert.IsTrue(output.Contains("HTML"), "Abbreviation text should be rendered");
Assert.IsTrue(output.Contains("W3C"), "Abbreviation text should be rendered");
Assert.IsFalse(output.Contains("HyperText Markup Language"), "Title should be suppressed");
Assert.IsFalse(output.Contains("World Wide Web Consortium"), "Title should be suppressed");
}

[TestMethod]
[DataRow(false)]
[DataRow(true)]
Expand Down
12 changes: 0 additions & 12 deletions DisplayOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public sealed class DisplayOptions
/// Style applied to the expansion title that follows an
/// <see cref="Markdig.Extensions.Abbreviations.AbbreviationInline"/> (e.g. the
/// <c>HyperText Markup Language</c> portion of <c>HTML (HyperText Markup Language)</c>).
/// Only used when <see cref="ShowAbbreviationTitle"/> is <see langword="true"/>.
/// </summary>
public TextStyle AbbreviationTitle { get; set; } = new(decoration: TextDecoration.Dim);

Expand Down Expand Up @@ -55,16 +54,6 @@ public sealed class DisplayOptions
/// </summary>
public TextStyle DefinitionTerm { get; set; } = new(decoration: TextDecoration.Bold);

/// <summary>
/// When <see langword="true"/> (the default), the expansion title of an
/// <see cref="Markdig.Extensions.Abbreviations.AbbreviationInline"/> is appended in
/// parentheses after the abbreviation text (e.g. <c>HTML (HyperText Markup Language)</c>),
/// styled with <see cref="AbbreviationTitle"/>.
/// When <see langword="false"/>, only the abbreviation text is rendered, keeping
/// the output compact.
/// </summary>
public bool ShowAbbreviationTitle { get; set; } = true;

/// <summary>
/// When set to true, the Info field from <see cref="Markdig.Syntax.FencedCodeBlock"/> (e.g., the language identifier) will be displayed.
/// </summary>
Expand Down Expand Up @@ -231,7 +220,6 @@ public sealed class DisplayOptions
MathBlockLabelText = this.MathBlockLabelText,
MathInline = this.MathInline,
QuotedBlock = this.QuotedBlock,
ShowAbbreviationTitle = this.ShowAbbreviationTitle,
ShowFencedCodeBlockInfo = this.ShowFencedCodeBlockInfo,
Strikethrough = this.Strikethrough,
Subscript = this.Subscript,
Expand Down
20 changes: 0 additions & 20 deletions ObjectRenderers/ConsoleAbbreviationInlineRenderer.cs

This file was deleted.

11 changes: 11 additions & 0 deletions ObjectRenderers/ConsoleObjectRenderers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BoxOfYellow.ConsoleMarkdownRenderer.Styling;
using Markdig.Extensions.Abbreviations;
using Markdig.Extensions.CustomContainers;
using Markdig.Extensions.DefinitionLists;
using Markdig.Extensions.Figures;
Expand Down Expand Up @@ -34,6 +35,16 @@ internal abstract class ConsoleObjectRenderer<TObject> : MarkdownObjectRenderer<
#region Simple-One liner Renders


internal class ConsoleAbbreviationInlineRenderer : ConsoleObjectRenderer<AbbreviationInline>
{
protected override void Write(ConsoleRenderer renderer, AbbreviationInline obj)
=> renderer
.WriteEscape(obj.Abbreviation.Label)
.AddInLine($" ([{renderer.Options.AbbreviationTitle.ToSpectreStyle().ToMarkup()}]")
.WriteEscape(obj.Abbreviation.Text.ToString())
.AddInLine("[/])");
}

// Note we conditionally included this one to help with tests. In non-test scenarios it is always included.
internal class ConsoleAutolinkInlineRenderer : ConsoleObjectRenderer<AutolinkInline>
{
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Upcoming Changes

### :art: Renderers :art:
- [#161](https://github.com/boxofyellow/ConsoleMarkdownRenderer/pull/161): Remove ShowAbbreviationTitle option
- [#143](https://github.com/boxofyellow/ConsoleMarkdownRenderer/pull/143): Honor Markdown pipe-table column alignment in ConsoleTableRenderer
- ``` markdown
| left | center | right |
Expand Down
Loading