Skip to content

[BUG] Syntax content is dedented and stripped in GitHub Actions #3500

Closed
@AAriam

Description

@AAriam

Describe the bug

from rich.console import Console
from rich.panel import Panel
from rich.syntax import Syntax

yaml_syntax = """
test: true
examples:
    ex1: 1
    ex2: 2
"""
code_panel = Panel(Syntax(yaml_syntax, lexer="yaml"))
console = Console(force_terminal=True)
console.print(code_panel)

Works fine in a terminal:

Screenshot 2024-09-25 at 17 07 19

But not on GitHub Actions:

Tip

When force_terminal is not set for Console, the problem is solved, but then of course you don't get any syntax highlighting!

Screenshot 2024-09-25 at 17 07 54

Note

The panel is just there to better illustrate the issue; the results are the same without it.

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