diff --git a/src/Textamina.Markdig/Parsers/InlineParserState.cs b/src/Textamina.Markdig/Parsers/InlineParserState.cs index 83c7befe..639b823d 100644 --- a/src/Textamina.Markdig/Parsers/InlineParserState.cs +++ b/src/Textamina.Markdig/Parsers/InlineParserState.cs @@ -33,7 +33,6 @@ namespace Textamina.Markdig.Parsers if (parsers == null) throw new ArgumentNullException(nameof(parsers)); StringBuilders = stringBuilders; Document = document; - InlinesToClose = new List(); Parsers = parsers; lineOffsets = new List(); Parsers.Initialize(this); @@ -95,11 +94,6 @@ namespace Textamina.Markdig.Parsers /// public TextWriter DebugLog { get; set; } - /// - /// Gets the list of inlines to close. - /// - private List InlinesToClose { get; } - /// /// Processes the inline of the specified . /// @@ -171,18 +165,6 @@ namespace Textamina.Markdig.Parsers // Get deepest container FindLastContainer().AppendChild(nextInline); } - - if (nextInline.IsClosable && !nextInline.IsClosed) - { - var inlinesToClose = InlinesToClose; - var last = inlinesToClose.Count > 0 - ? InlinesToClose[inlinesToClose.Count - 1] - : null; - if (last != nextInline) - { - InlinesToClose.Add(nextInline); - } - } } else { @@ -203,14 +185,7 @@ namespace Textamina.Markdig.Parsers } } - // Close all inlines not closed Inline = null; - foreach (var inline in InlinesToClose) - { - inline.CloseInternal(this); - } - InlinesToClose.Clear(); - if (DebugLog != null) { DebugLog.WriteLine("** Dump before Emphasis:"); diff --git a/src/Textamina.Markdig/Syntax/Inlines/AutoLinkInline.cs b/src/Textamina.Markdig/Syntax/Inlines/AutoLinkInline.cs index ccd12ca7..dfd2ff5a 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/AutoLinkInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/AutoLinkInline.cs @@ -2,12 +2,15 @@ // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. +using System.Diagnostics; + namespace Textamina.Markdig.Syntax.Inlines { /// /// An autolink (Section 6.7 CommonMark specs) /// /// + [DebuggerDisplay("<{Url}>")] public class AutolinkInline : LeafInline { /// diff --git a/src/Textamina.Markdig/Syntax/Inlines/CodeInline.cs b/src/Textamina.Markdig/Syntax/Inlines/CodeInline.cs index b1819377..4f40d1de 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/CodeInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/CodeInline.cs @@ -2,12 +2,15 @@ // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. +using System.Diagnostics; + namespace Textamina.Markdig.Syntax.Inlines { /// /// Represents a code span (Section 6.3 CommonMark specs) /// /// + [DebuggerDisplay("`{Content}`")] public class CodeInline : LeafInline { /// diff --git a/src/Textamina.Markdig/Syntax/Inlines/DelimiterInline.cs b/src/Textamina.Markdig/Syntax/Inlines/DelimiterInline.cs index 4dea604a..3e933ca5 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/DelimiterInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/DelimiterInline.cs @@ -2,6 +2,7 @@ // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. using System; +using System.Diagnostics; using Textamina.Markdig.Parsers; namespace Textamina.Markdig.Syntax.Inlines @@ -10,6 +11,7 @@ namespace Textamina.Markdig.Syntax.Inlines /// Internal delimiter used by some parsers (e.g emphasis, tables). /// /// + [DebuggerDisplay("{ToLiteral()} {Type}")] public abstract class DelimiterInline : ContainerInline { protected DelimiterInline(InlineParser parser) @@ -39,10 +41,5 @@ namespace Textamina.Markdig.Syntax.Inlines /// /// The string representation of this delimiter public abstract string ToLiteral(); - - public override string ToString() - { - return $"{ToLiteral()} {Type}"; - } } } \ No newline at end of file diff --git a/src/Textamina.Markdig/Syntax/Inlines/EmphasisInline.cs b/src/Textamina.Markdig/Syntax/Inlines/EmphasisInline.cs index aadf0490..95cf174a 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/EmphasisInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/EmphasisInline.cs @@ -2,12 +2,15 @@ // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. +using System.Diagnostics; + namespace Textamina.Markdig.Syntax.Inlines { /// /// An emphasis and strong emphasis (Section 6.4 CommonMark specs). /// /// + [DebuggerDisplay("{DelimiterChar} Strong: {Strong}")] public class EmphasisInline : ContainerInline { /// @@ -19,10 +22,5 @@ namespace Textamina.Markdig.Syntax.Inlines /// Gets or sets a value indicating whether this is strong. /// public bool Strong { get; set; } - - public override string ToString() - { - return Strong ? $"{DelimiterChar}{DelimiterChar}" : $"{DelimiterChar}"; - } } } \ No newline at end of file diff --git a/src/Textamina.Markdig/Syntax/Inlines/HardlineBreakInline.cs b/src/Textamina.Markdig/Syntax/Inlines/HardlineBreakInline.cs index 99e681e2..ed2e6b3b 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/HardlineBreakInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/HardlineBreakInline.cs @@ -1,17 +1,17 @@ // Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. + +using System.Diagnostics; + namespace Textamina.Markdig.Syntax.Inlines { /// /// A hard line break (Section 6.9 CommonMark specs). /// /// + [DebuggerDisplay("
/")] public class HardlineBreakInline : LineBreakInline { - public override string ToString() - { - return "
"; - } } } \ No newline at end of file diff --git a/src/Textamina.Markdig/Syntax/Inlines/HtmlInline.cs b/src/Textamina.Markdig/Syntax/Inlines/HtmlInline.cs index 740d3aa0..28d189a5 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/HtmlInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/HtmlInline.cs @@ -1,12 +1,16 @@ // Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. + +using System.Diagnostics; + namespace Textamina.Markdig.Syntax.Inlines { /// /// A Raw HTML (Section 6.8 CommonMark specs). /// /// + [DebuggerDisplay("{Tag}")] public class HtmlInline : LeafInline { /// diff --git a/src/Textamina.Markdig/Syntax/Inlines/Inline.cs b/src/Textamina.Markdig/Syntax/Inlines/Inline.cs index 26d7ae0c..6cc4e701 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/Inline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/Inline.cs @@ -34,11 +34,6 @@ namespace Textamina.Markdig.Syntax.Inlines /// public bool IsClosed { get; set; } - /// - /// Gets or sets a value indicating whether this instance is closable. - /// - public bool IsClosable { get; protected set; } - /// /// Inserts the specified inline after this instance. /// @@ -243,19 +238,6 @@ namespace Textamina.Markdig.Syntax.Inlines { } - internal void CloseInternal(InlineParserState state) - { - if (!IsClosed) - { - Close(state); - IsClosed = true; - } - } - - protected virtual void Close(InlineParserState state) - { - } - /// /// Dumps this instance to . /// diff --git a/src/Textamina.Markdig/Syntax/Inlines/LinkInline.cs b/src/Textamina.Markdig/Syntax/Inlines/LinkInline.cs index 357af4b0..095c2cc6 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/LinkInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/LinkInline.cs @@ -1,12 +1,16 @@ // Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. + +using System.Diagnostics; + namespace Textamina.Markdig.Syntax.Inlines { /// /// A Link inline (Section 6.5 CommonMark specs) /// /// + [DebuggerDisplay("Url: {Url} Title: {Title} Image: {IsImage}")] public class LinkInline : ContainerInline { /// @@ -41,10 +45,5 @@ namespace Textamina.Markdig.Syntax.Inlines /// Gets or sets a value indicating whether this instance is an image link. /// public bool IsImage { get; set; } - - public override string ToString() - { - return (IsImage ? ""; - } } } diff --git a/src/Textamina.Markdig/Syntax/Inlines/LiteralInline.cs b/src/Textamina.Markdig/Syntax/Inlines/LiteralInline.cs index 451a0180..21ca8538 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/LiteralInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/LiteralInline.cs @@ -2,6 +2,7 @@ // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. using System; +using System.Diagnostics; using Textamina.Markdig.Helpers; using Textamina.Markdig.Parsers; @@ -11,6 +12,7 @@ namespace Textamina.Markdig.Syntax.Inlines /// A literal inline. /// /// + [DebuggerDisplay("{Content}")] public class LiteralInline : LeafInline { /// @@ -36,14 +38,5 @@ namespace Textamina.Markdig.Syntax.Inlines /// The content as a . /// public StringSlice Content; - - protected override void Close(InlineParserState state) - { - } - - public override string ToString() - { - return Content.ToString(); - } } } \ No newline at end of file diff --git a/src/Textamina.Markdig/Syntax/Inlines/SoftlineBreakInline.cs b/src/Textamina.Markdig/Syntax/Inlines/SoftlineBreakInline.cs index ebd55af1..65b800ee 100644 --- a/src/Textamina.Markdig/Syntax/Inlines/SoftlineBreakInline.cs +++ b/src/Textamina.Markdig/Syntax/Inlines/SoftlineBreakInline.cs @@ -1,17 +1,17 @@ // Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. + +using System.Diagnostics; + namespace Textamina.Markdig.Syntax.Inlines { /// /// A soft line break (Section 6.10 CommonMark specs) /// /// + [DebuggerDisplay("\\n")] public class SoftlineBreakInline : LineBreakInline { - public override string ToString() - { - return "\\n"; - } } } \ No newline at end of file