Flattens the token stream.
(self, tokens: Iterable[Token])
| 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 |