Skip to content

Markdown code block injection can leak to the surrounding context #9678

@kirawi

Description

@kirawi

Summary

If the code block's closing backticks have trailing space, the injected syntax highlighting will apply to the text outside of the code block.

Reproduction Steps

Open a markdown buffer with the contents:

'''c
''' 
int i = 0;

where the quotes are replaced with backticks.

I expected this to happen:

int i = 0; should be highlighted as markdown

Instead, this happened:

It is highlighted as C

Helix log

No response

Platform

Linux/macOS

Terminal Emulator

Kitty 0.30.1

Installation Method

Source

Helix Version

990378a

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-language-supportArea: Support for programming/text languagesC-bugCategory: This is a bugupstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions