MCPcopy
hub / github.com/Textualize/rich / _flatten_tokens

Method _flatten_tokens

rich/markdown.py:569–577  ·  view source on GitHub ↗

Flattens the token stream.

(self, tokens: Iterable[Token])

Source from the content-addressed store, hash-verified

567 self.inline_code_theme = inline_code_theme or code_theme
568
569 def _flatten_tokens(self, tokens: Iterable[Token]) -> Iterable[Token]:
570 """Flattens the token stream."""
571 for token in tokens:
572 is_fence = token.type == "fence"
573 is_image = token.tag == "img"
574 if token.children and not (is_image or is_fence):
575 yield from self._flatten_tokens(token.children)
576 else:
577 yield token
578
579 def __rich_console__(
580 self, console: Console, options: ConsoleOptions

Callers 1

__rich_console__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected