Grab all heading in a certain note by shortcut?

Is there any way to use iOS Shortcuts to retrieve all headings from a single note and turn them into a list or a dictionary?

Thanks!

The only way that comes to mind is, once you retrieve a note with the get note action, and you can access the note.text searching for new lines starting with # , ## , ### ,…

1 Like

That works! Thanks for your suggestion!

1 Like

Hi, @trix180

Thank you for your assistance last time. I would like to inquire again about the previous topic: Is there a way to use iOS Shortcuts to find specific paragraphs within a specific heading in a particular note?

If you have any suggestions, please help me out. Thank you.

You have access to the text field of a note object in Shortcuts so you can search the text and find the paragraph it belongs. Doing this for a specific header is tricky but I think can be done by using regular expressions.

The idea is

  • Searching for all the headers and split the text into “sections” aka the portion of text between the header beginning the beginning of the next header.
  • For each section search the “term” you are looking for

I have to say approaching this kind of text operations and data structures with Shortcuts is probably not the best. Maybe if you have some Python background you can make use of XCallback URLs to get the note content and then do all the operations.