[BUG] emoji_variant is ignored when markup contains tags

オープン 初心者向け
#4,267 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

issue では、rich.markup.render 内の2つの経路と、プレーンテキストのセグメントで欠けている emoji_variant 引数が示されています。この関数と既存の markup テストを読み、render(":warning:", emoji_variant="emoji") と太字タグ付きのバージョンを比較する回帰ケースを追加してください。両方の出力に U+FE0F が含まれ、関連するテストが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

Needs triage
  • I've checked the docs and existing issues for possible solutions.
  • I can't find this issue in the FAQ.

Describe the bug

emoji_variant is applied when markup contains no square brackets, but appears to be dropped when the markup has style tags. In rich.markup.render, the no-bracket fast path calls emoji_replace(markup, default_variant=emoji_variant). In the general parsing loop, plain-text segments call emoji_replace(plain_text) without forwarding emoji_variant.

Minimal reproduction (Rich 15.0.0):

from rich.markup import render

plain = render(":warning:", emoji_variant="emoji").plain
tagged = render("[bold]:warning:[/bold]", emoji_variant="emoji").plain

print(repr(plain), [hex(ord(char)) for char in plain])
print(repr(tagged), [hex(ord(char)) for char in tagged])
assert plain == tagged

Actual result

'⚠️' ['0x26a0', '0xfe0f']
'⚠' ['0x26a0']

The assertion fails because the tagged case is missing U+FE0F.

Expected result

Both strings should include U+FE0F and be equal. This means the configured emoji presentation is consistent with and without markup tags.

The same code path is used by callers such as Text.from_markup. I reproduced the issue with render(); I have not separately tested every higher-level caller.

Platform

Reproduced with Rich 15.0.0 on macOS.

主要言語
Python
スター
57.8k
フォーク
2.6k
平均マージ
20分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Textualize/rich のほかの issue

Textualize/rich の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。