Fold SOME headers command

Hi!
I am looking for suggestions for how to solve this in a better way.
My study notes surves two purposes, i want to keep details for reference but just as often i need the notes in less detail for quick-reference

For now i use this script with a shorcut to toggle headlines with ###### (because it seems that ###### is the same as #### in appearance so its hidden) or those containing ˅

Im thinking someone else probably has a bettter solution for the actual need or maybe can give me pointers on how to improve the script.

silverbullet.registerCommand({name: "foldsix"}, async () => {
  const thistext = await editor.getText();
  const thistextarray = thistext.split("\n");
  for (let [linenr,a] of thistextarray.entries()) {
    if (a.startsWith("######")||a.search("˅")!=-1 ){
      
      
       await editor.flashNotification("Found foldsix or ˅  at  ".concat(String(linenr)) );
      const wherewasi = await editor.getCursor(); 
      await editor.moveCursorToLine(linenr+1);
      await editor.toggleFold();
      await editor.moveCursor(wherewasi);
      
    }
  }
    
});
  • BTW thanks Zef & contributors its a great program!
1 Like