MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / parseBlock

Method parseBlock

src/common/markdown-block.ts:43–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 }
42
43 parseBlock(): TaggedBlock | null {
44 this.skipWhitespace();
45
46 if (this.match('#')) {
47 return this.parseHeading();
48 } else if (this.match('>')) {
49 return this.parseBlockquote();
50 } else if (this.match('```')) {
51 return this.parseCodeBlock();
52 } else if (this.match(':::')) {
53 return this.parseCallout();
54 } else if (
55 this.peek() === '*' ||
56 this.peek() === '-' ||
57 this.peek() === '+' ||
58 this.isDigit(this.peek())
59 ) {
60 return this.parseList();
61 } else if (this.peek() === '|') {
62 return this.parseTable();
63 } else {
64 return this.parseParagraph();
65 }
66 }
67
68 parseHeading(): TaggedBlock {
69 let level = 1;

Callers 1

parseBlocksMethod · 0.95

Calls 11

skipWhitespaceMethod · 0.95
parseHeadingMethod · 0.95
parseBlockquoteMethod · 0.95
parseCodeBlockMethod · 0.95
parseCalloutMethod · 0.95
isDigitMethod · 0.95
parseListMethod · 0.95
parseTableMethod · 0.95
parseParagraphMethod · 0.95
matchMethod · 0.65
peekMethod · 0.45

Tested by

no test coverage detected