```ts
export function tagCount(line: string): number {
  if (line === null || line === undefined) throw new Error('Expecting input to be a string');

  let markerCount = 0;
  let inMarker = false;

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

    if (char === '<') {
      if (!inMarker) {
        inMarker = true;
        markerCount++;
      }
    } else if (char === '>') {
      if (inMarker) {
        inMarker = false;
      } else {
        throw new Error('Unmatched closing bracket found');
      }
    } else if (inMarker && char !== ' ') {
      // Ignore characters between markers
      continue;
    }

    if (!inMarker) break;
  }

  return markerCount;
}
```