Skip to content

Regression: triple-backtick code blocks broken when closing fence isn't on its own line (since v6.7.0) #30685

@dkumankov

Description

@dkumankov

Steps to reproduce

All three forms below are sent as plain text instead of code blocks:

  1. Single-line: ```text```

  2. Multi-line, closing on last content line:

    ```
    line one
    line two```
    
  3. Multi-line with language tag, closing on last content line:

    ```cpp
    int x = 1;
    return x;```
    

Expected behaviour

All three render as code blocks; payload contains messageEntityPre.

Actual behaviour

Plain text with literal backticks visible. No entity is attached.

Only forms where the closing ``` sits on its own line (preceded by \n) still work.

Operating system

Windows 11

Version of Telegram Desktop

Broken in v6.7.0 (2026‑04‑04), still in v6.8.1 (current). Worked correctly in v6.6.x and earlier. Bug lives in the lib_ui markdown parser — all OSes affected

Installation source

Static binary from official website

Crash ID

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions