Folding on editor side is easy to achieve. I could add an option to the Appearance tab in settings.
But I am not the one who makes the decisions. Laurent will have to approve and I can add it.
The integration to the rendered markdown is a bit more involved. You’d basically need 2 toolbar buttons for a section (collapsed/not collapsed), so I don’t think Laurent would go for that. (I wouldn’t.) But I could be wrong.
IMO this makes no sense. If you wanted to add a section, it should be closed by default.
You are not going to read a text and stumble across an open section and just close it. In that case, it should not have been open in the first place. The whole idea is to hide details in a text that you can look at, if you need it. Not the other way around.
yes, you are right. I’m sorry for not retesting the stuff, I used the code from ipra and just tested the folding…
I found out that for rendering markdown code inside the <summary> and inside the folded text an empty line before the markdown code is needed. The markdown renderer inside this forum here shows the exact same behavior.
The following example shows how to render markdown inside the summary and the content of a folded section. The only issue that it shows, is that the folding arrow is shown in an empty line before the summary headline.
### Summary of folded text
* first item
* second item
#### Test subchapter 1
Test numbered list
1. Numbered list item 1
2. Numbered list item 2
#### Test subchapter 2
Extended information which is folded by default.
my idea behind the whole folding stuff is coming from an experience I made with a wysiwyg text editor. It displays a folding arrow besides each headline. With that you can fold down your document to have a better overview and to blend out not needed details.
Do you think that maybe such a behavior (automatically support folding of headlines inside the rendered markdown) can be implemented inside the markdown renderer? This would not need to extend toolbars etc, so the main user will not see any change but the arrows shown in the rendered markdown besides each headline...
For me this would be very great. A second step for this feature could be that the state of the folding would be safed inside the markdown code of the headline. With this it would be like importing antigravity...
I think about something like extending the markdown code for headlines with an optional part that tells if the content is folded or not. As soon as the user folds down a headline inside the markdown preview (rendered), the [folded] tag appears inside the editor between the headline start tag ### and the headline text.
@laurent What do you think about that? This could make the work with long notes much more comfortable for power users...
### Standard headline - as supported right now
### [folded] Folded headline
Text which is folded at the moment
Expected rendered markdown
(the displayed arrows should be in the same line as the headline, sorry for that)
I think there are 2 topics around folding: one is the text (source/markdown)and the other is the rendered text (preview).
The folding marks in the editor will allow you to fold text in the editor. Nothing will happen on the preview side.And the folding marks will be whereever the ace editor thinks they should be. (I know they will fold sections (header to the next header), or code blocks, but I’m not sure what else. I don’t use code folding for taking notes. Especially since those will be uncollapsed again when you open the note. They do not persist. So what’s the point?
Folding in the preview is only possible with the HTML that was discussed earlier.
I think any more than that is out of the scope of this project. This is a note-taking application, not a content management system with word processor capabilities. And I am glad that it isn’t. I despise word processors for many reasons which I don’t want to go into.
I certainly understand your wish to add certain features, but IMO there are more important things to tackle first.
My last post here was for “Folding on rendered markdown”.
For me it is ok, if there is a decision to not do anything in such a direction. It was just an idea, because I think this could help all power users that have big notes.
I am working with large notes and I also think that folding sections will be extremely useful to help navigation within the relevant parts of a note in both editor and rendered HTML (could be an option for both).
Even if they are unfolded on each note reload, it is better than nothing (a simple "collapse all" button would be nice though).
Please don't forget that Joplin is not a text editor - or at least it is not its main purpose.
Also, even if there was code folding, it would not be persistent, so how useful is it really? Anyway, Caleb is right. This might be done via plugin at one point.
Just my two cents: while Joplin is made to be a coding application first, it should be equally friendly for those that want to put notes in Joplin. One of the reasons I moved to Joplin was because of its encryption. Unfortunately, Joplin doesn't seem to have easy access to features OneNote had - such as using Tab easily, as well as collapsible text. In OneNote, you could collapse any text that was tabbed underneath the text. All you would do would be to double click the left side of the main title and BAM, all text would be collapsed. PLUS, it would stay that way until you un-collapsed it.
I read tessus' post that "Please don't forget that Joplin is not a text editor - or at least it is not its main purpose." on this thread. I defaulted to assuming that it was for code, as it does use the markdown editor heavily.