Bug 441278 - folding bug when editing markdown
Summary: folding bug when editing markdown
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: folding (show other bugs)
Version: 21.04.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-21 09:05 UTC by ghands
Modified: 2021-09-01 12:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Unexpected Folding in Markdown (3.96 KB, image/png)
2021-08-21 09:08 UTC, ghands
Details
Source Markdown Code (5.44 KB, image/png)
2021-08-21 09:08 UTC, ghands
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ghands 2021-08-21 09:05:59 UTC
SUMMARY

When folding markdown code according to the level of title, the higher level of title is folded into the lower level

STEPS TO REPRODUCE
1. Input markdown code like ``# Hello \n ## World \n # Bye \n ## Evil''
2. Folding the line ``## World'', you will find the ``# Bye'' is folded.

OBSERVED RESULT
(There is no downward in ASCII, I use ^ to mean the unfolded line)
^ # Hello
> ## World
^ ## Evil

EXPECTED RESULT
(There is no downward in ASCII, I use ^ to mean the unfolded line)
^ # Hello
> ## World
^ # Bye
^ ## Evil

SOFTWARE/OS VERSIONS
Windows: Windows 10 20H2
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 ghands 2021-08-21 09:08:27 UTC
Created attachment 140903 [details]
Unexpected Folding in Markdown
Comment 2 ghands 2021-08-21 09:08:50 UTC
Created attachment 140904 [details]
Source Markdown Code
Comment 3 Bug Janitor Service 2021-08-31 14:38:15 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/251
Comment 4 Jan Paul Batrina 2021-09-01 12:54:37 UTC
Git commit a49918bbce6edb8c03c28435787c7e4a0a732bf0 by Jan Paul Batrina.
Committed on 31/08/2021 at 14:34.
Pushed by cullmann into branch 'master'.

markdown.xml: End nested sub-headers fold regions when parent header is closed

e.g.

 # H1
 ## H2
 ### H3
 # H1 <-- All headers above should end here

This is currently done using a hack, visible to users
since part of the next header is included in the
previous region (e.g. [### H3\n# H]1 is how the region
above will be marked).

In the future, a better solution would be to provide a mechanism
to close multiple folding regions with a single rule.

M  +211  -199  autotests/folding/test.markdown.fold
M  +56   -44   autotests/html/test.markdown.dark.html
M  +56   -44   autotests/html/test.markdown.html
M  +12   -0    autotests/input/test.markdown
M  +56   -44   autotests/reference/test.markdown.ref
M  +25   -6    data/syntax/markdown.xml

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