mirror of
https://github.com/xoofx/markdig.git
synced 2026-11-17 09:51:24 +00:00
Expose line start indexes
This commit is contained in:
@@ -444,6 +444,8 @@ namespace Markdig.Parsers
|
||||
{
|
||||
CurrentLineStartPosition = newLine.Start;
|
||||
|
||||
Document.LineStartIndexes?.Add(CurrentLineStartPosition);
|
||||
|
||||
ContinueProcessingLine = true;
|
||||
|
||||
ResetLine(newLine);
|
||||
|
||||
@@ -85,6 +85,9 @@ namespace Markdig.Parsers
|
||||
/// <returns>A document instance</returns>
|
||||
private MarkdownDocument Parse()
|
||||
{
|
||||
if (preciseSourceLocation)
|
||||
document.LineStartIndexes = new List<int>();
|
||||
|
||||
ProcessBlocks();
|
||||
ProcessInlines();
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// 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.Collections.Generic;
|
||||
|
||||
namespace Markdig.Syntax
|
||||
{
|
||||
/// <summary>
|
||||
@@ -20,5 +22,11 @@ namespace Markdig.Syntax
|
||||
/// Gets the number of lines in this <see cref="MarkdownDocument"/>
|
||||
/// </summary>
|
||||
public int LineCount;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of zero-based indexes of line beginnings in the source span
|
||||
/// <para>Available if <see cref="MarkdownPipelineBuilder.PreciseSourceLocation"/> is used, otherwise null</para>
|
||||
/// </summary>
|
||||
public List<int> LineStartIndexes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user