Shortcut action unexpected result (blank line)

Hi gang!

Something I have encountered is that when using the Get Note Text action in Shortcuts, I am getting a blank line at the end of the text.

My use case is that I keep a numerical index of projects as a list, and I expect to:

  • Get Note Text
  • Split text by new lines
  • Get last item from split text
  • Match \d{3} in item (my three digit project number)
  • Add 1 to that number along with the new project name
  • Append that to the note

This all works except that I have to get last item minus one in order to get what is actually the last line of text.

I’ve worked around this (by getting the second last item), it just feels a little odd.

Probably minor, but I thought I’d share anyway! :heart:

ScottyJ

Hi Scotty,

Good to hear from you!

My guess is that just having a return on your last line forms a new line. In any case, there is a bit of ambiguity, because I assume you get the note text as markdown, which is not our internal format.

I will take a look and see if we can change this. Need to be careful not to ruin the general markdown export etc.

Kind regards,
Drew

Oh that’s interesting! I am appending Markdown (because there are links and I’m lazy), but I don’t see any parameters in the Get Text to choose formatting the pull. I wonder if Shortcuts itself does any funny business with formats in order to manipulate text?

At any rate, this is hardly a giant issue, but I wanted to be a thorough citizen and all.

Thanks so much!

Just spitballing but what if you do not enter a return at the end of a new entry until appending the next new?

The actual note in Agenda has no empty line, and any text appended is appended as a line of text without carriage return, but thanks for double-checking!

I think it is just happening in the conversion. You never get to see the internal representation of Agenda; it has to convert to something you can read, like Markdown. The converter is probably inserting a new line to make the output nicer for export. We can see if we can control that a bit more for shortcuts.