Can shortlinks get an "invocation-count" variable

I’m porting a website to Zola, and find myself searching for ways to manage end notes and margin notes. One hangup has been that shortcode-based solutions lack (at least as far as I can tell) a way to automatically number the resulting codes. It would be nice if a built-in variable (a la the body variable) were introduced that was simply an integer representing the number of times a particular shortcode was used up to that point in a given .md file. For the sake of example, let’s call the proposed variable instance. Then, given a shortcode template “sidenote.html:”

<aside id="sn{{ instance }}">{{ instance }}: {{ body }}</aside>

instance would resolve to “1” on the first invocation of {% sidenote %}, “2” on the second invocation, and so forth. If you come to a consensus that this seems reasonable, I will gladly start work on a PR.