Folding support in Markdown
There seems to be no folding support markdown mode. This should be relatively trivial to add, as the syntax for the headings is already there.
Current behavior:
- Open a Markdown document with several header levels (
# h1 section foo,## h2 section bar, etc.) - Try to code fold a section (e.g. h3 level)
- Nothing happens 😞
Expected behavior:
- Open a Markdown document with several header levels (
#,##, etc.) - Try to code fold
- Block gets folded 🤗 (eg. all third level headings get folded to
### h3 section baz {…})
While it seems that way, currently folding does need a hierarchical concept which the structure of markdown doesn't give. E.g. while headlines are recognized, they don't have content or demark a region per se.
That being said a folding mode for non-hierarchical syntax would be nice and interesting. Also the mode could be rewritten to create states for headings (however, due to the nature of markdown, e.g. the ability to use the non ### variant of headings just by underlining, and mix and match, doing this correctly would be slightly challenging)
OK, that explains it. As I mostly write longer prose in markdown, it would be very welcomed enhancement. As a new user it took me some time to figure out that folding with markdown just does not work. Because the markdown mode is prominently featured in the screenshot on the landing page and the app store, I got the impression that everything was supposed to work. At first I thought I was simply inept to use the functionality properly.
I am currently using the vim with vim-markdown-folding to get folding support. Having the collab features of SubEthaEdit together with this would be great. If I find some time, I will look into the code to and try hack something up. Doing it correctly will probably exceed my abilities. There is also the standardized parser from Commonmark, but that would probably be overkill in this case.
@tolmasky wondering if you could have a look to do this easily?
I can definitely give it a shot. Funny enough, I ran into the non-hierarchical data situation in another project I was doing with Markdown.