internal static Common.InlineParseResult Parse(string markdown, int start, int maxEnd)
{
// Check the start sequence.
if (start >= maxEnd - 1 || markdown.Substring(start, 2) != "~~")
return null;
// Find the end of the span.
var innerStart = start + 2;
int innerEnd = Common.IndexOf(markdown, "~~", innerStart, maxEnd);
if (innerEnd == -1)
return null;
// The span must contain at least one character.
if (innerStart == innerEnd)
return null;
// The first character inside the span must NOT be a space.
if (Common.IsWhiteSpace(markdown[innerStart]))
return null;
// The last character inside the span must NOT be a space.
if (Common.IsWhiteSpace(markdown[innerEnd - 1]))
return null;
// We found something!
var result = new StrikethroughTextInline();
result.Inlines = Common.ParseInlineChildren(markdown, innerStart, innerEnd);
return new Common.InlineParseResult(result, start, innerEnd + 2);
}