mirror of
https://github.com/xoofx/markdig.git
synced 2026-10-10 07:37:38 +00:00
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using Textamina.Markdig.Helpers;
|
|
using Textamina.Markdig.Parsing;
|
|
|
|
namespace Textamina.Markdig.Syntax
|
|
{
|
|
public class QuoteBlock : ContainerBlock
|
|
{
|
|
public static readonly BlockParser Parser = new ParserInternal();
|
|
|
|
private class ParserInternal : BlockParser
|
|
{
|
|
public override MatchLineResult Match(MatchLineState state)
|
|
{
|
|
var liner = state.Line;
|
|
|
|
liner.SkipLeadingSpaces3();
|
|
|
|
// 5.1 Block quotes
|
|
// A block quote marker consists of 0-3 spaces of initial indent, plus (a) the character > together with a following space, or (b) a single character > not followed by a space.
|
|
var c = liner.Current;
|
|
if (c != '>')
|
|
{
|
|
return MatchLineResult.None;
|
|
}
|
|
|
|
c = liner.NextChar();
|
|
if (CharHelper.IsSpace(c))
|
|
{
|
|
liner.NextChar();
|
|
}
|
|
|
|
if (state.Block == null)
|
|
{
|
|
state.Block = new QuoteBlock();
|
|
}
|
|
|
|
return MatchLineResult.Continue;
|
|
}
|
|
}
|
|
}
|
|
} |