Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Tui] Fix unattached widget element styles#64234

Merged
nicolas-grekas merged 1 commit into
symfony:8.1symfony/symfony:8.1from
masskrdjn:fix-markdown-rendermasskrdjn/symfony:fix-markdown-renderCopy head branch name to clipboard
May 20, 2026
Merged

[Tui] Fix unattached widget element styles#64234
nicolas-grekas merged 1 commit into
symfony:8.1symfony/symfony:8.1from
masskrdjn:fix-markdown-rendermasskrdjn/symfony:fix-markdown-renderCopy head branch name to clipboard

Conversation

@masskrdjn
Copy link
Copy Markdown
Contributor

@masskrdjn masskrdjn commented May 17, 2026

Q A
Branch? 8.1
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #64217
License MIT

MarkdownWidget::render() can be used directly with a standalone RenderContext, but sub-element styles were only resolved when the widget was attached to a TUI tree. In that standalone case, AbstractWidget::resolveElement() returned an empty style, so Markdown headings, bold text, italic text, links, and other styled inline elements silently rendered without their default styling.

This changes the fallback at the widget level: when a widget is not attached to a context, sub-element styles are resolved from the default TUI stylesheet. That keeps standalone rendering consistent with attached rendering for core widgets.

For example:

$markdown = new MarkdownWidget("# Hello\n\nsome **bold** and *italic* text");
$lines = $markdown->render(new RenderContext(60, 20));

Before, the heading kept the raw Markdown marker and inline formatting lost its ANSI styling:

# Hello

some bold and italic text

After, the heading content is rendered without the Markdown syntax marker and default ANSI styles are applied to the heading, bold, and italic spans.

A regression test covers rendering an unattached MarkdownWidget directly with RenderContext.

@masskrdjn masskrdjn marked this pull request as ready for review May 17, 2026 18:48
@carsonbot carsonbot added this to the 8.1 milestone May 17, 2026
@symfony symfony deleted a comment from carsonbot May 20, 2026
@symfony symfony deleted a comment from carsonbot May 20, 2026
@symfony symfony deleted a comment from carsonbot May 20, 2026
@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @masskrdjn.

@nicolas-grekas nicolas-grekas merged commit d004e68 into symfony:8.1 May 20, 2026
8 of 12 checks passed
@fabpot fabpot mentioned this pull request May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TUI] MarkdownWidget::render() silently degrades when called without widget-tree attachment

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.