Inspired by a workflow used at TidBits, here’s a script that allows you to use [*] reference links as lazy markers. The first [*]: http://... definition found after a [link][*] will be used as the definition for it. It’s easier to show:

This is my text and [this is my link][*]. I'll define
the url for that link under the paragraph.


I can use [multiple][*] lazy links in [a paragraph][*],
and then just define them in order below it.


This allows you to not bother naming or numbering links while writing, and easily move links along with their paragraphs without breaking numbering sequences or naming conventions.

It requires a little scripting to work, though, as you have to process the lazy links before running it through your normal processor. This script works as a Custom Preprocessor in Marked 2, as well as a standalone script as part of a chained workflow:

#!/usr/bin/env ruby
# encoding: utf-8
# Marked 2 preprocessor
# Allows use of `*` link references where the next [*]: href defines the link
# Inspired by [tidbits][*]
# [*]:
if RUBY_VERSION.to_f > 1.8
	input ='UTF-8')
	input =

counter = 0

while input =~ /(\[[^\]]+\]\s*\[)\*(\].*?^\[)\*\]\:/m
	input.sub!(/(\[[^\]]+\]\s*\[)\*(\].*?^\[)\*\]\:/m) {
		counter += 1
		$1 + counter.to_s + $2 + counter.to_s + "]:"

print input

If this fits with the way you typically write, it’s a neat trick. Credit goes to Glenn Fleishman at TidBits for the idea and original implementation.