Skip to content

DAG code syntax highlighting is incorrect with f-strings #67986

Closed

Description

@zhaorui2022

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.2.2

What happened and how to reproduce it?

When using operators with f-strings, the code syntax highlighting is incorrect.

An example to reproduce the issue

    table_name = "example_catalog.example_schema.example_table"

    validate_data = DatabricksSqlOperator(
        task_id="validate_data",
        sql=f"""
        SELECT CASE WHEN COUNT(*) = 0 THEN 1 ELSE 0 END
        FROM {table_name}
        WHERE ds = '{{{{ ds }}}}'
        """,
        databricks_conn_id="databricks_default",
    )

This is rendered like this

Image

What you think should happen instead?

FROM {table_name}
WHERE ds = '{{{{ ds }}}}'

should be red
and

,
databricks_conn_id="databricks_default",

should be black

Operating System

Debian GNU/Linux 12 (bookworm)

Deployment

None

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

No response

Official Helm Chart version

Not Applicable

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

Used the official docker image for 3.2.2

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bugThis is a clearly a bug
    needs-triagelabel for new issues that we didn't triage yet
    on Jun 4, 2026
  2. added
    area:UIRelated to UI/UX. For Frontend Developers.
    on Jun 4, 2026
  3. Revanth14 commented on Jun 4, 2026

    @Revanth14
    Contributor

    I can work on this, will raise PR shortly.

  4. Revanth14 commented on Jun 4, 2026

    @Revanth14
    Contributor

    opened #68026 to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:UIRelated to UI/UX. For Frontend Developers.kind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions