```ts
export function tagCount(line: string): number {
  if (typeof line !== 'string') {
    throw new Error('Line must be a string');
  }

  let count = 0;
  let inMarker = false;

  for (let i = 0; i < line.length; i++) {
    const char = line[i];

    if (char === '<') {
      inMarker = true;
    } else if (char === '>') {
      if (inMarker) {
        count++;
        inMarker = false;
      }
    }
  }

  return count;
}
```