Bug 495147 - ghostwriter markdown highlighting fails for fenced code blocks attributes with non ASCII characters
Summary: ghostwriter markdown highlighting fails for fenced code blocks attributes wit...
Status: REPORTED
Alias: None
Product: ghostwriter
Classification: Applications
Component: general (other bugs)
Version First Reported In: 23.08.5
Platform: Kubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: megan.conkle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-21 15:44 UTC by Christophe Agathon
Modified: 2024-10-21 15:44 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Agathon 2024-10-21 15:44:19 UTC
SUMMARY
The markdown editor displays code blocks on a lighter background than regular text (assuming dark theme).
When editing pandoc markdown, one can set attributes to the code block. Ghostwriter highlighting is OK with that unless there is at least one non-ASCII character in them.
In this scenario it seems to simply ignore the opening fence and start to apply the lighter background starting with the closing fence until it find the end of file or another fence.


STEPS TO REPRODUCE
1. Create a markdown document with the following markdown content :
Here is some code :

~~~~~~~ {title = "Code numéro 1"}
if (a > 3) {
  moveShip(5 * gravity, DOWN);
}
~~~~~~~

Here is the same code once again :

~~~~~~~ {title = "Code numéro 2"}
if (a > 3) {
  moveShip(5 * gravity, DOWN);
}
~~~~~~~

This is it.

OBSERVED RESULT
The markdown text is displayed on the regular background from the beginning to the last line of code of the first code block (lines 1 to 6).
The code block background is used from the closing fence of the first block to the closing fence of the second block (lines
7 to 15).
Back to regular background for the end of the text (lines 16 and 17)

In short both opening fences are ignored by the markdown syntax highlighting system.

EXPECTED RESULT
Code block background from opening fence to closing fence for each code block.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Kubuntu 24.04
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13

ADDITIONAL INFORMATION

Everything is OK in the editor if there are ASCII characters only in the attributes (eg "Code #1" instead of "Code numéro 1")

Might be related [#487636](https://bugs.kde.org/show_bug.cgi?id=487636)