---
title: '"Lazy" Markdown footnotes'
date: 2013-10-30 08:00
slug: lazy-markdown-footnotes
categories:
- Code
tags:
- markdown
- multimarkdown
- marked
---

[Carl Johnson](http://blog.carlsensei.com/) left a [comment][brettterpstra] on my ["Lazy Markdown Links"][brettterpstra 2] post to mention that he's long used a similar "lazy" method for footnotes. It struck me as a great idea. I whipped up another [preprocessor](https://gist.github.com/7219134)[^fn1] for [Marked 2][marked2app 2] to make it work. It works as a standalone script, too.

[^fn1]: [Documentation here][marked2app]

While I thought the lazy Markdown links were a neat trick, they didn't really affect my personal writing style. I generally work in one of three ways: gather all of my reference links at once and put them together at the bottom, write inline links for speed and use the Markdown Service Tools to "Flip Link Style" and clean them up as reference links, or I'm using SearchLink with a combination of the above. None of those lend themselves to the lazy style. My footnote format, however, is perfect for it.

Let me first say that Fletcher Penney has recently made this irrelevant in [MultiMarkdown 4][github] ([downloads here][fletcherpenney]). In MMD 4, you can now use `[^ this is my footnote]` and it will become a standard footnote. Even more recently, he added a --random option to randomize generated footnote ids and avoid duplication in scenarios such as blogs which render multiple documents and generate repeated footnote labels. That's as lazy as you can get (and exactly what I had in mind with the [inline footnotes Service][brettterpstra 3]). 

That being said, I still like being able to separate my footnotes below the text so that my Markdown can be read the same way I want my output formatted. I rewrote the Lazy Markdown Links script to do footnotes instead. It accepts two formats: `[^]` and `` (Option-T). You can use either or both freely, as long as the marker in the text matches the first following footnote you want to connect. Example text would look like...

    Lorem ipsum dolor sit amet[^], consectetur adipisicing elit, sed
    do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
    enim ad minim veniam, quis nostrud exercitation[^] ullamco laboris
    nisi ut aliquip ex ea commodo consequat.

    [^]: This footnote will replace the first caret marker found in
    the text.

    : This one will replace the first "cross." The syntaxes are 
    auto-detected and interchangeable.

    [^]: This one replaces the second caret instance.

    Inspired by tidbits[^] and Carl Johnson

    [^]: <http://tidbits.com>

    : <http://blog.carlsensei.com/>

From which the script will generate (with random id prefixes)...

    Lorem ipsum dolor sit amet[^fn184555-1], consectetur adipisicing
    elit, sed do eiusmod tempor[^fn184555-2] incididunt ut labore et
    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
    exercitation[^fn184555-3] ullamco laboris nisi ut aliquip ex ea
    commodo consequat.

    [^fn184555-1]: This footnote will replace the first caret marker
    found in the text.

    [^fn184555-2]: This one will replace the first "cross." The
    syntaxes are auto-detected and interchangeable.

    [^fn184555-3]: This one replaces the second caret instance.

    Inspired by tidbits[^fn184555-4] and Carl Johnson[^fn184555-5]

    [^fn184555-4]: <http://tidbits.com>

    [^fn184555-5]: <http://blog.carlsensei.com/>

You can find [the script on GitHub](https://gist.github.com/7219134). It can be set up in [Marked 2][marked2app 2] as follows.

1. Save it to a folder as `lazyfootnotes.rb`
2. Run `chmod a+x lazyfootnotes.rb` on it in Terminal to make it executable
3. In Marked 2, go to the Behavior preferences and select the **Custom Preprocessor** tab
4. Enter the path to the script, such as `~/scripts/lazyfootnotes.rb`
5. Check the box to make it "Enabled by default"
6. Copy the text of the first example above and hit "Command-Shift-V" in Marked 2 to test

As always, hope somebody else finds this useful, too.

[brettterpstra]: http://brettterpstra.com/2013/10/19/lazy-markdown-reference-links/#comment-1089359738
[brettterpstra 2]: http://brettterpstra.com/2013/10/19/lazy-markdown-reference-links/
[brettterpstra 3]: http://brettterpstra.com/2012/01/24/a-service-for-writing-multimarkdown-footnotes-inline/
[fletcherpenney]: http://fletcherpenney.net/multimarkdown/download/
[github]: https://github.com/fletcher/MultiMarkdown-4
[marked2app]: http://marked2app.com/help/Custom_Processor.html#preprocessor
[marked2app 2]: http://marked2app.com

---

Brett is a writer and developer living in Minnesota, USA. You can follow him as ttscoff. This content is supported by readers like you. [More about Brett](https://brettterpstra.com/contact.md), including social links.

Copyright © 2026 Brett Terpstra. All rights reserved.
