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
Created attachment 140903 [details] Unexpected Folding in Markdown
Created attachment 140904 [details] Source Markdown Code
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/251
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