src/Markdig/Parsers/InlineProcessor.cs
/// <summary>
/// Gets the source position for the specified offset within the current slice.
/// </summary>
/// <param name="sliceOffset">The slice offset.</param>
/// <param name="lineIndex">The line index.</param>
/// <param name="column">The column.</param>
/// <returns>The source position</returns>
Gets the source position for the specified offset within the current slice.
Gets the source position for the specified offset within the current slice .
public int GetSourcePosition(int sliceOffset, out int lineIndex, out int column)
        {
            column = 0;
            lineIndex = sliceOffset >= previousSliceOffset ? previousLineIndexForSliceOffset : 0;
            int position = 0;
            if (PreciseSourceLocation)
            {
                for (; lineIndex < lineOffsets.Count; lineIndex++)
                {
                    var lineOffset = lineOffsets[lineIndex];
                    if (sliceOffset <= lineOffset.End)
                    {
                        previousSliceOffset = lineOffsets[lineIndex].Start;
                        var delta = sliceOffset - previousSliceOffset;
                        column = lineOffsets[lineIndex].Column + delta;
                        position = lineOffset.LinePosition + delta + lineOffsets[lineIndex].Offset;
                        previousLineIndexForSliceOffset = lineIndex;
                        lineIndex = lineIndex + LineIndex;
                        break;
                    }
                }
            }
            return position;
        }
public int GetSourcePosition ( int sliceOffset , out int lineIndex , out int column ) { column = 0 ; lineIndex = sliceOffset >= previousSliceOffset ? previousLineIndexForSliceOffset : 0 ; int position = 0 ; if ( PreciseSourceLocation ) { for ( ; lineIndex < lineOffsets . Count ; lineIndex ++ ) { var lineOffset = lineOffsets [ lineIndex ] ; if ( sliceOffset <= lineOffset . End ) { previousSliceOffset = lineOffsets [ lineIndex ] . Start ; var delta = sliceOffset - previousSliceOffset ; column = lineOffsets [ lineIndex ] . Column + delta ; position = lineOffset . LinePosition + delta + lineOffsets [ lineIndex ] . Offset ; previousLineIndexForSliceOffset = lineIndex ; lineIndex = lineIndex + LineIndex ; break ; } } } return position ; }
Gets the source position for the specified offset within the current slice.
Gets the source position for the specified offset within the current slice .
// Use the beginning of the line as a previous slice offset // (since it is on the same line) // Return an absolute line index
The source position
The source position
sliceOffset
int
The slice offset.
The slice offset .
int
out
lineIndex
The line index.
The line index .
column
None