Fix most build warnings

This commit is contained in:
MihaZupan
2021-03-08 11:37:29 +01:00
parent ab53969f06
commit 1e2399669d
24 changed files with 45 additions and 49 deletions

View File

@@ -137,6 +137,7 @@ namespace Markdig
/// Parses the specified markdown into an AST <see cref="MarkdownDocument"/>
/// </summary>
/// <param name="markdown">The markdown text.</param>
/// <param name="trackTrivia">Whether to parse trivia such as whitespace, extra heading characters and unescaped string values.</param>
/// <returns>An AST Markdown document</returns>
/// <exception cref="ArgumentNullException">if markdown variable is null</exception>
public static MarkdownDocument Parse(string markdown, bool trackTrivia = false)

View File

@@ -39,7 +39,7 @@ using Markdig.Extensions.ReferralLinks;
namespace Markdig
{
/// <summary>
/// Provides extension methods for <see cref="MarkdownPipeline"/> to enable several Markdown extensions.
/// Provides extension methods for <see cref="MarkdownPipelineBuilder"/> to enable several Markdown extensions.
/// </summary>
public static class MarkdownExtensions
{

View File

@@ -41,6 +41,7 @@ namespace Markdig.Parsers
/// <param name="document">The document to build blocks into.</param>
/// <param name="parsers">The list of parsers.</param>
/// <param name="context">A parser context used for the parsing.</param>
/// <param name="trackTrivia">Whether to parse trivia such as whitespace, extra heading characters and unescaped string values.</param>
/// <exception cref="ArgumentNullException">
/// </exception>
public BlockProcessor(MarkdownDocument document, BlockParserList parsers, MarkdownParserContext context, bool trackTrivia = false)

View File

@@ -70,7 +70,7 @@ namespace Markdig.Parsers
/// <summary>
/// The roundtrip parser for the information after the fenced code block special characters (usually ` or ~)
/// </summary>
/// <param name="state">The parser processor.</param>
/// <param name="blockProcessor">The parser processor.</param>
/// <param name="line">The line.</param>
/// <param name="fenced">The fenced code block.</param>
/// <param name="openingCharacter">The opening character for this fenced code block.</param>

View File

@@ -35,6 +35,7 @@ namespace Markdig.Parsers
/// <param name="parsers">The parsers.</param>
/// <param name="preciseSourcelocation">A value indicating whether to provide precise source location.</param>
/// <param name="context">A parser context used for the parsing.</param>
/// <param name="trackTrivia">Whether to parse trivia such as whitespace, extra heading characters and unescaped string values.</param>
/// <exception cref="ArgumentNullException">
/// </exception>
public InlineProcessor(MarkdownDocument document, InlineParserList parsers, bool preciseSourcelocation, MarkdownParserContext context, bool trackTrivia = false)

View File

@@ -25,12 +25,7 @@ namespace Markdig.Parsers
private readonly MarkdownDocument document;
private readonly ProcessDocumentDelegate documentProcessed;
private readonly bool preciseSourceLocation;
/// <summary>
/// True to parse trivia such as whitespace, extra heading characters and unescaped
/// string values.
/// </summary>
public bool TrackTrivia { get; }
private readonly bool trackTrivia;
private readonly int roughLineCountEstimate;
@@ -49,7 +44,7 @@ namespace Markdig.Parsers
if (text == null) ThrowHelper.ArgumentNullException_text();
if (pipeline == null) ThrowHelper.ArgumentNullException(nameof(pipeline));
TrackTrivia = pipeline.TrackTrivia;
trackTrivia = pipeline.TrackTrivia;
roughLineCountEstimate = text.Length / 40;
text = FixupZero(text);
lineReader = new LineReader(text);
@@ -121,7 +116,7 @@ namespace Markdig.Parsers
// If this is the end of file and the last line is empty
if (lineText.Text is null)
{
if (TrackTrivia)
if (trackTrivia)
{
Block lastBlock = blockProcessor.LastBlock;
if (lastBlock == null && document.Count == 0)

View File

@@ -10,7 +10,7 @@ namespace Markdig.Renderers.Roundtrip
/// <summary>
/// An Roundtrip renderer for a <see cref="CodeBlock"/> and <see cref="FencedCodeBlock"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{CodeBlock}" />
/// <seealso cref="RoundtripObjectRenderer{CodeBlock}" />
public class CodeBlockRenderer : RoundtripObjectRenderer<CodeBlock>
{
protected override void Write(RoundtripRenderer renderer, CodeBlock obj)

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip
/// <summary>
/// An Roundtrip renderer for a <see cref="HeadingBlock"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{HeadingBlock}" />
/// <seealso cref="RoundtripObjectRenderer{HeadingBlock}" />
public class HeadingRenderer : RoundtripObjectRenderer<HeadingBlock>
{
private static readonly string[] HeadingTexts = {

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip.Inlines
/// <summary>
/// A Normalize renderer for an <see cref="AutolinkInline"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{AutolinkInline}" />
/// <seealso cref="RoundtripObjectRenderer{AutolinkInline}" />
public class AutolinkInlineRenderer : RoundtripObjectRenderer<AutolinkInline>
{
protected override void Write(RoundtripRenderer renderer, AutolinkInline obj)

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip.Inlines
/// <summary>
/// A Normalize renderer for a <see cref="CodeInline"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{CodeInline}" />
/// <seealso cref="RoundtripObjectRenderer{CodeInline}" />
public class CodeInlineRenderer : RoundtripObjectRenderer<CodeInline>
{
protected override void Write(RoundtripRenderer renderer, CodeInline obj)

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip.Inlines
/// <summary>
/// A Normalize renderer for a <see cref="DelimiterInline"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{DelimiterInline}" />
/// <seealso cref="RoundtripObjectRenderer{DelimiterInline}" />
public class DelimiterInlineRenderer : RoundtripObjectRenderer<DelimiterInline>
{
protected override void Write(RoundtripRenderer renderer, DelimiterInline obj)

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip.Inlines
/// <summary>
/// A Normalize renderer for an <see cref="EmphasisInline"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{EmphasisInline}" />
/// <seealso cref="RoundtripObjectRenderer{EmphasisInline}" />
public class EmphasisInlineRenderer : RoundtripObjectRenderer<EmphasisInline>
{
protected override void Write(RoundtripRenderer renderer, EmphasisInline obj)

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip.Inlines
/// <summary>
/// A Normalize renderer for a <see cref="LineBreakInline"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{LineBreakInline}" />
/// <seealso cref="RoundtripObjectRenderer{LineBreakInline}" />
public class LineBreakInlineRenderer : RoundtripObjectRenderer<LineBreakInline>
{
protected override void Write(RoundtripRenderer renderer, LineBreakInline obj)

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip.Inlines
/// <summary>
/// A Normalize renderer for a <see cref="LinkInline"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{LinkInline}" />
/// <seealso cref="RoundtripObjectRenderer{LinkInline}" />
public class LinkInlineRenderer : RoundtripObjectRenderer<LinkInline>
{
protected override void Write(RoundtripRenderer renderer, LinkInline link)

View File

@@ -10,7 +10,7 @@ namespace Markdig.Renderers.Roundtrip.Inlines
/// <summary>
/// A Normalize renderer for a <see cref="LiteralInline"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{LiteralInline}" />
/// <seealso cref="RoundtripObjectRenderer{LiteralInline}" />
public class LiteralInlineRenderer : RoundtripObjectRenderer<LiteralInline>
{
protected override void Write(RoundtripRenderer renderer, LiteralInline obj)

View File

@@ -11,7 +11,7 @@ namespace Markdig.Renderers.Roundtrip
/// <summary>
/// A Roundtrip renderer for a <see cref="ListBlock"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{ListBlock}" />
/// <seealso cref="RoundtripObjectRenderer{ListBlock}" />
public class ListRenderer : RoundtripObjectRenderer<ListBlock>
{
protected override void Write(RoundtripRenderer renderer, ListBlock listBlock)

View File

@@ -10,7 +10,7 @@ namespace Markdig.Renderers.Roundtrip
/// <summary>
/// A Roundtrip renderer for a <see cref="ParagraphBlock"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{ParagraphBlock}" />
/// <seealso cref="RoundtripObjectRenderer{ParagraphBlock}" />
[DebuggerDisplay("renderer.Writer.ToString()")]
public class ParagraphRenderer : RoundtripObjectRenderer<ParagraphBlock>
{

View File

@@ -6,14 +6,13 @@ using System.IO;
using Markdig.Syntax;
using Markdig.Renderers.Roundtrip.Inlines;
using Markdig.Helpers;
using Markdig.Parsers;
namespace Markdig.Renderers.Roundtrip
{
/// <summary>
/// Markdown renderer honoring trivia for a <see cref="MarkdownDocument"/> object.
/// </summary>
/// Ensure to enable the <see cref="MarkdownParser.TrackTrivia"/> property when
/// Ensure to call the <see cref="MarkdownExtensions.EnableTrackTrivia"/> extension method when
/// parsing markdown to have trivia available for rendering.
public class RoundtripRenderer : TextRendererBase<RoundtripRenderer>
{
@@ -51,8 +50,6 @@ namespace Markdig.Renderers.Roundtrip
/// Writes the lines of a <see cref="LeafBlock"/>
/// </summary>
/// <param name="leafBlock">The leaf block.</param>
/// <param name="writeEndOfLines">if set to <c>true</c> write end of lines.</param>
/// <param name="indent">Whether to write indents.</param>
/// <returns>This instance</returns>
public void WriteLeafRawLines(LeafBlock leafBlock)
{

View File

@@ -9,7 +9,7 @@ namespace Markdig.Renderers.Roundtrip
/// <summary>
/// A Roundtrip renderer for a <see cref="ThematicBreakBlock"/>.
/// </summary>
/// <seealso cref="NormalizeObjectRenderer{ThematicBreakBlock}" />
/// <seealso cref="RoundtripObjectRenderer{ThematicBreakBlock}" />
public class ThematicBreakRenderer : RoundtripObjectRenderer<ThematicBreakBlock>
{
protected override void Write(RoundtripRenderer renderer, ThematicBreakBlock obj)

View File

@@ -57,27 +57,27 @@ namespace Markdig.Syntax
/// <summary>
/// Gets or sets the trivia right before this block.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice TriviaBefore { get; set; }
/// <summary>
/// Gets or sets trivia occurring after this block.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice TriviaAfter { get; set; }
/// <summary>
/// Gets or sets the empty lines occurring before this block.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise null.
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise null.
/// </summary>
public List<StringSlice> LinesBefore { get; set; }
/// <summary>
/// Gets or sets the empty lines occurring after this block.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise null.
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise null.
/// </summary>
public List<StringSlice> LinesAfter { get; set; }

View File

@@ -31,7 +31,7 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// Gets or sets the content with trivia and whitespace.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice ContentWithTrivia { get; set; }
@@ -39,7 +39,7 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// True if the first and last character of the content enclosed in a backtick `
/// is a space.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// false.
/// </summary>
public bool FirstAndLastWasSpace { get; set; }

View File

@@ -62,14 +62,14 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// Gets or sets the <see cref="Label"/> with trivia.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice LabelWithTrivia { get; set; }
/// <summary>
/// Gets or sets the type of label parsed
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="LocalLabel.None"/>.
/// </summary>
public LocalLabel LocalLabel { get; set; }
@@ -92,7 +92,7 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// Gets or sets the trivia before the <see cref="Url"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice TriviaBeforeUrl { get; set; }
@@ -100,7 +100,7 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// True if the <see cref="Url"/> in the source document is enclosed
/// in pointy brackets.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// false.
/// </summary>
public bool UrlHasPointyBrackets { get; set; }
@@ -117,14 +117,14 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// The <see cref="Url"/> but with trivia and unescaped characters
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice UnescapedUrl { get; set; }
/// <summary>
/// Any trivia after the <see cref="Url"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice TriviaAfterUrl { get; set; }
@@ -137,7 +137,7 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// Gets or sets the character used to enclose the <see cref="Title"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public char TitleEnclosingCharacter { get; set; }
@@ -155,14 +155,14 @@ namespace Markdig.Syntax.Inlines
/// <summary>
/// Gets or sets the <see cref="Title"/> exactly as parsed from the
/// source document including unescaped characters
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice UnescapedTitle { get; set; }
/// <summary>
/// Gets or sets the trivia after the <see cref="Title"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice TriviaAfterTitle { get; set; }

View File

@@ -73,6 +73,7 @@ namespace Markdig.Syntax
/// <param name="column">The column.</param>
/// <param name="line">The line.</param>
/// <param name="sourceLinePosition"></param>
/// <param name="trackTrivia">Whether to keep track of trivia such as whitespace, extra heading characters and unescaped string values.</param>
public void AppendLine(ref StringSlice slice, int column, int line, int sourceLinePosition, bool trackTrivia)
{
if (Lines.Lines == null)

View File

@@ -47,7 +47,7 @@ namespace Markdig.Syntax
/// <summary>
/// Gets or sets the label. Text is normalized according to spec.
/// </summary>
/// <see cref="https://spec.commonmark.org/0.29/#matches"/>
/// https://spec.commonmark.org/0.29/#matches
public string Label { get; set; }
/// <summary>
@@ -57,14 +57,14 @@ namespace Markdig.Syntax
/// <summary>
/// Non-normalized Label (includes trivia)
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice LabelWithTrivia { get; set; }
/// <summary>
/// Whitespace before the <see cref="Url"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice TriviaBeforeUrl { get; set; }
@@ -81,21 +81,21 @@ namespace Markdig.Syntax
/// <summary>
/// Non-normalized <see cref="Url"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice UnescapedUrl { get; set; }
/// <summary>
/// True when the <see cref="Url"/> is enclosed in point brackets in the source document.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// false.
/// </summary>
public bool UrlHasPointyBrackets { get; set; }
/// <summary>
/// gets or sets the whitespace before a <see cref="Title"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice TriviaBeforeTitle { get; set; }
@@ -112,14 +112,14 @@ namespace Markdig.Syntax
/// <summary>
/// Non-normalized <see cref="Title"/>.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise
/// <see cref="StringSlice.IsEmpty"/>.
/// </summary>
public StringSlice UnescapedTitle { get; set; }
/// <summary>
/// Gets or sets the character the <see cref="Title"/> is enclosed in.
/// Trivia: only parsed when <see cref="MarkdownParser.TrackTrivia"/> is enabled, otherwise \0.
/// Trivia: only parsed when <see cref="MarkdownPipeline.TrackTrivia"/> is enabled, otherwise \0.
/// </summary>
public char TitleEnclosingCharacter { get; set; }