1 min read 179 words Updated Feb 23, 2025 Created Feb 23, 2025
##espanso##obsidian##perl

Espanso and Obsidian footnotes

It turns out that Espanso is a convenient way to insert inline footnotes into Obsidian.

My inline footnotes look something like this in the Obsidian document {{1234 Here is a footnote.}} before final processing.

I defined a new Espanso rule where typing :fn is replaced with the necessary squiggly brackets, a random number (generated by a Perl script which does some other things as well) and then places the cursor in the correct location to enter the footnote text.

  - trigger: ":fn"
    replace: "\\{\\{{{output}} $|$}}"
    vars:
      - name: output
        type: script
        params:
          args: [perl, "%CONFIG%/scripts/obsidianRandomFootnote.pl"]

Alternatively, you can execute simple code inline rather than calling a separate script, like this:

  - trigger: ":inline:"
    replace: "\\{\\{{{output}} $|$}}"
    vars:
      - name: output
        type: script
        params:
          args: [perl, -e, 'print int 1 + rand(9999)']

Of course, most readers will use something a little more up-to-date than Perl, but I'm old skool 😄.

Note that the Espanso configuration file is YAML, with all the usual formatting peccadilloes this format has.

#obsidian #espanso #perl