// Root, --- Done // Paragraph, --- Done // Header,// #(1-6)、===、--- --- Done // HorizontalRule,// ---、*** // List, // +、-、*、number. --- Done // Code, // Four spaces or \t // Quote, // > // ListItemBuilder, // Table, // 表 | 1 | 2 | // LinkReference, // [name](url) internal static MarkdownBlock ParseBlock(string markdownText, int start, int end, out int actualEnd) { actualEnd = start; MarkdownBlock block = null; char nonSpaceChar = GetNonSpaceChar(markdownText, start, end, out int nonSpacePos); if (nonSpaceChar == '#' && nonSpacePos == start) { block = HeaderBlock.Parse(markdownText, start, end, out actualEnd); } if (block == null && (nonSpaceChar == '*' || nonSpaceChar == '-' || nonSpaceChar == '_')) { block = HorizontalRuleBlock.Parse(markdownText, start, end, out actualEnd); } if (block == null && (nonSpaceChar == '*' || nonSpaceChar == '+' || nonSpaceChar == '-' || (nonSpaceChar >= '0' && nonSpaceChar <= '9'))) { block = ListElement.Parse(markdownText, start, end, out actualEnd); } if (block == null) { block = ParagraphBlock.Parse(markdownText, start, end, out actualEnd); } return(block); }