Bug 500809 - Apostrophe in text breaks highlighting of YAML markup
Summary: Apostrophe in text breaks highlighting of YAML markup
Status: REPORTED
Alias: None
Product: kate
Classification: Applications
Component: encoding (show other bugs)
Version: 24.12.2
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-27 11:18 UTC by daobrien
Modified: 2025-03-17 06:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description daobrien 2025-02-27 11:18:23 UTC
SUMMARY
The use of an apostrophe in a string inside an array causes the syntax highlighting to fail from the apostrophe to the end of the file. If I double quote the string the problem doesn't occur. Problem does not occur if I use a backtick.

STEPS TO REPRODUCE
1. Create a simple YAML file and ensure the file type is set to "markup:yaml".
2. Create a key in a YAML file that takes its values from an array.
3. Enter a string that contains an apostrophe in the array.

OBSERVED RESULT

From the apostrophe to the end of the file syntax highlighting no longer works.

EXPECTED RESULT

Syntax highlighting should not fail.

SOFTWARE/OS VERSIONS
Fedora 41
GNOME Shell 47.4
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

Example entry that fails:
editors: [David O'Brien]

Example entry that does not fail:
editors: ["David O'Brien"]
Comment 1 Christoph Cullmann 2025-03-01 19:58:46 UTC
https://yaml.org/spec/1.2.2/#single-quoted-style

Is that not just a side effect on ' starting a single quoted string?
Comment 2 John Kizer 2025-03-16 03:10:05 UTC
Hi - just changing status here as this appears to be pending a response, thanks!
Comment 3 daobrien 2025-03-17 06:42:41 UTC
(In reply to Christoph Cullmann from comment #1)
> https://yaml.org/spec/1.2.2/#single-quoted-style
> 
> Is that not just a side effect on ' starting a single quoted string?

tbh I don't know. If this falls under the heading of "expected behaviour" then ok, but it took me by surprise. I currently get around it by not using an array. Feel free to close this if you think it's not a bug.
cheers.