MCPcopy Index your code
hub / github.com/markdoc/markdoc / block

Function block

src/tokenizer/plugins/annotations.ts:51–81  ·  view source on GitHub ↗
(
  state: StateBlock,
  startLine: number,
  endLine: number,
  silent: boolean
)

Source from the content-addressed store, hash-verified

49}
50
51function block(
52 state: StateBlock,
53 startLine: number,
54 endLine: number,
55 silent: boolean
56): boolean {
57 const start = state.bMarks[startLine] + state.tShift[startLine];
58 const finish = state.eMarks[startLine];
59
60 if (!state.src.startsWith(OPEN, start)) return false;
61
62 const tagEnd = findTagEnd(state.src, start);
63 const lastPossible = state.src.slice(0, finish).trim().length;
64
65 if (!tagEnd || tagEnd < lastPossible - CLOSE.length) return false;
66
67 const contentStart = start + OPEN.length;
68 const content = state.src.slice(contentStart, tagEnd).trim();
69 const lines = state.src
70 .slice(start, tagEnd + CLOSE.length)
71 .split('\n').length;
72
73 if (content[0] === '$') return false;
74
75 if (silent) return true;
76
77 const token = createToken(state, content, contentStart);
78 token.map = [startLine, startLine + lines];
79 state.line += lines;
80 return true;
81}
82
83function inline(state: StateInline, silent: boolean): boolean {
84 if (!state.src.startsWith(OPEN, state.pos)) return false;

Callers

nothing calls this directly

Calls 2

findTagEndFunction · 0.90
createTokenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…