Bug 445918

Summary: Markdown headings highlighted completely in purple rending text unreadable
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: janik
Component: themeAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: janik, jpmbatrina01
Priority: NOR    
Version: 5.88.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: screenshot

Description janik 2021-11-22 13:14:20 UTC
Created attachment 143834 [details]
screenshot

SUMMARY
When editing markdown, headings are highlighted in a way that renders the text unreadable. The whole box around the text is colored (in my theme purple).


STEPS TO REPRODUCE
1.  open .md file
2. create heading (# heading)
3. look at highlight

OBSERVED RESULT
everything colored but the last character. See attached Image 

EXPECTED RESULT
highlighted but still readable

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 21.08.03 on Arch Linux
(available in About System)
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
Related https://bugs.kde.org/show_bug.cgi?id=444422
Comment 1 Jan Paul Batrina 2021-11-25 00:20:14 UTC
Confirmed with these steps:

1. open/create .md file
2. Insert the following text:

# heading
## heading

# heading 2

3. Place cursor on "# heading 2"

This is (unintentionally) caused by the folding region highlight introduced by https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/194. The fix would be to ensure that the Heading color(s) and the Bracket Highlight Color are not the same, at least for the default color schemes.
Comment 2 Bug Janitor Service 2021-11-28 12:11:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/277
Comment 3 Christoph Cullmann 2021-12-03 20:03:04 UTC
Git commit 6188135d40c8f62176c5762896d130cc0c95bd4e by Christoph Cullmann, on behalf of Jan Paul Batrina.
Committed on 03/12/2021 at 19:53.
Pushed by cullmann into branch 'master'.

markdown.xml: Fix highlighting of headers (include last char)

d277eb4134a2aab4d5981b605faa85b83ae4f552 introduced a hack
to close subheaders by using a header's last char as the
closing character for the subheader regions. This made the
last character always highlighted as an H6 header (which
was not visible with the Breeze themes since all headers
had the same color).

An invisible sentinel region is now used so that the header
regions won't be paired together, preventing erroneous
folding region highlights.
Related: bug 444422

M  +54   -54   autotests/folding/test.markdown.fold
M  +53   -53   autotests/html/test.markdown.dark.html
M  +53   -53   autotests/html/test.markdown.html
M  +53   -53   autotests/reference/test.markdown.ref
M  +23   -13   data/syntax/markdown.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/6188135d40c8f62176c5762896d130cc0c95bd4e