diff --git a/ConsoleMarkdownRenderer.Tests/RendererTests.cs b/ConsoleMarkdownRenderer.Tests/RendererTests.cs index b2ac9b5..fc819aa 100644 --- a/ConsoleMarkdownRenderer.Tests/RendererTests.cs +++ b/ConsoleMarkdownRenderer.Tests/RendererTests.cs @@ -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)] diff --git a/DisplayOptions.cs b/DisplayOptions.cs index b4c827d..e3acaf8 100644 --- a/DisplayOptions.cs +++ b/DisplayOptions.cs @@ -13,7 +13,6 @@ public sealed class DisplayOptions /// Style applied to the expansion title that follows an /// (e.g. the /// HyperText Markup Language portion of HTML (HyperText Markup Language)). - /// Only used when is . /// public TextStyle AbbreviationTitle { get; set; } = new(decoration: TextDecoration.Dim); @@ -55,16 +54,6 @@ public sealed class DisplayOptions /// public TextStyle DefinitionTerm { get; set; } = new(decoration: TextDecoration.Bold); - /// - /// When (the default), the expansion title of an - /// is appended in - /// parentheses after the abbreviation text (e.g. HTML (HyperText Markup Language)), - /// styled with . - /// When , only the abbreviation text is rendered, keeping - /// the output compact. - /// - public bool ShowAbbreviationTitle { get; set; } = true; - /// /// When set to true, the Info field from (e.g., the language identifier) will be displayed. /// @@ -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, diff --git a/ObjectRenderers/ConsoleAbbreviationInlineRenderer.cs b/ObjectRenderers/ConsoleAbbreviationInlineRenderer.cs deleted file mode 100644 index 98070c3..0000000 --- a/ObjectRenderers/ConsoleAbbreviationInlineRenderer.cs +++ /dev/null @@ -1,20 +0,0 @@ -using BoxOfYellow.ConsoleMarkdownRenderer.Styling; -using Markdig.Extensions.Abbreviations; - -namespace BoxOfYellow.ConsoleMarkdownRenderer.ObjectRenderers -{ - internal class ConsoleAbbreviationInlineRenderer : ConsoleObjectRenderer - { - protected override void Write(ConsoleRenderer renderer, AbbreviationInline obj) - { - renderer.WriteEscape(obj.Abbreviation.Label); - if (renderer.Options.ShowAbbreviationTitle) - { - renderer - .AddInLine($" ([{renderer.Options.AbbreviationTitle.ToSpectreStyle().ToMarkup()}]") - .WriteEscape(obj.Abbreviation.Text.ToString()) - .AddInLine("[/])"); - } - } - } -} diff --git a/ObjectRenderers/ConsoleObjectRenderers.cs b/ObjectRenderers/ConsoleObjectRenderers.cs index 676a8cb..6142532 100644 --- a/ObjectRenderers/ConsoleObjectRenderers.cs +++ b/ObjectRenderers/ConsoleObjectRenderers.cs @@ -1,4 +1,5 @@ using BoxOfYellow.ConsoleMarkdownRenderer.Styling; +using Markdig.Extensions.Abbreviations; using Markdig.Extensions.CustomContainers; using Markdig.Extensions.DefinitionLists; using Markdig.Extensions.Figures; @@ -34,6 +35,16 @@ internal abstract class ConsoleObjectRenderer : MarkdownObjectRenderer< #region Simple-One liner Renders + internal class ConsoleAbbreviationInlineRenderer : ConsoleObjectRenderer + { + 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 { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 8b7d2bf..3500ccd 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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 |