code: def _parse(
      markup: str,
  ) -> Iterable[Tuple[int, Optional[str], Optional[Tag]]]:
      """Parse markup in to an iterable of tuples of (position, text, tag).
  
      Args:
          markup (str): A string containing console markup
  
      """
      position = 0
      _divmod = divmod
      _Tag = Tag
      for match in RE_TAGS.finditer(markup):
          full_text, escapes, tag_text = match.groups()
          start, end = match.span()
          if start > position:
              yield start, markup[position:start], None
          if escapes:
              backslashes, escaped = _divmod(len(escapes), 2)
              if backslashes:
                  # Literal backslashes
                  yield start, "\\" * backslashes, None
                  start += backslashes * 2
              if escaped:
                  # Escape of tag
                  yield start, full_text[len(escapes) :], None
                  position = end
                  continue
          text, equals, parameters = tag_text.partition("=")
          yield start, None, _Tag(text, parameters if equals else None)
          position = end
      if position < len(markup):
          yield position, markup[position:], None
  
file_path: rich/rich/markup.py
imports: import re
  from ast import literal_eval
  from operator import attrgetter
  from typing import Callable, Iterable, List, Match, NamedTuple, Optional, Tuple, Union
  from ._emoji_replace import _emoji_replace
  from .emoji import EmojiVariant
  from .errors import MarkupError
  from .style import Style
  from .text import Span, Text
label_desc: Use image node_id 2 for calling a global function with example usage: _parse(markup) without return types