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

Function findTagEnd

src/utils.ts:26–52  ·  view source on GitHub ↗
(content: string, start = 0)

Source from the content-addressed store, hash-verified

24}
25
26export function findTagEnd(content: string, start = 0) {
27 let state = STATES.normal;
28 for (let pos = start; pos < content.length; pos++) {
29 const char = content[pos];
30
31 switch (state) {
32 case STATES.string:
33 switch (char) {
34 case '"':
35 state = STATES.normal;
36 break;
37 case '\\':
38 state = STATES.escape;
39 break;
40 }
41 break;
42 case STATES.escape:
43 state = STATES.string;
44 break;
45 case STATES.normal:
46 if (char === '"') state = STATES.string;
47 else if (content.startsWith(CLOSE, pos)) return pos;
48 }
49 }
50
51 return null;
52}
53
54function parseTag(content: string, line: number, contentStart: number) {
55 try {

Callers 5

utils.test.tsFile · 0.90
blockFunction · 0.90
inlineFunction · 0.90
coreFunction · 0.90
parseTagsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…