Skip to content

[BUG] Failure to propagate formatting overrides via ConsoleOptions #4028

@kmvanbrunt

Description

@kmvanbrunt

⚠️ UPDATE: Revised Scope
Upon further investigation, this is not limited to a missing emoji setting.

There are two core issues

  1. ConsoleOptions is missing an emoji field. Therefore, emoji overrides passed to console.print() are ignored.
  2. Multiple classes (Table, Rule, Columns, and Measure) fail to pass some or all of emoji, markup, and highlight settings from their ConsoleOptions back to console.render_str().

I have a fix but I am currently unable to create a pull request in this repo.

See this fork for the fix:
https://github.com/kmvanbrunt/rich/tree/emoji_console_option

Original Description

When printing a complex renderable like a Table, passing emoji=False to console.print() does not disable emoji parsing within the table cells if the Console was initialized with emoji=True (the default).

This appears to be because ConsoleOptions does not include an emoji field, and Console.render() does not propagate the emoji preference to render_str().

Here is code to reproduce the bug.

from rich.console import Console
from rich.table import Table

# Create Console with markup and emoji enabled
console = Console(markup=True, emoji=True)
t = Table(show_header=False)
t.add_row("[blue]some text[/blue]", ":1234:")

print("Normal print() shows markup and emoji rendering")
console.print(t)

# Attempt to override markup and emoji when printing a Table
print("Print overrides only work for markup and the emoji still renders")
console.print(t, markup=False, emoji=False)

Here is a screenshot of the results.

Image

Platform
rich==14.3.3
Python 3.11.2
Debian 12.13

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions