Reference Links with Common Base for Citations etc


#1

It would be swell if there was a citation extension that allowed simple “sub references” in shortcut reference links, e.g. to a page [range/collection] or named section/chapter.

This could work by handling [foo:bar], [foo#bar] or [foo?bar] differently from normal shortcut reference links like [foo]. Examples:

[author2016:123]
[PDF#page=123]
[script?key=value]

[author2016]: isbn:1234567890
[PDF]: document.pdf
[script]: search.php7

That means, the part prior to the first colon :, hash # or question mark ? (maybe also slash /), i.e. foo here, would suffice to be specified as a reference link definition on a separate line:

[foo]: http://example.org/foo`

A more exlicit definition could still overwrite default handling:

[foo:bar]: http://example.org/foo/bar`
[foo#bar]: http://example.org/foo/bar`
[foo?bar]: http://example.org/foo/bar`

This should of course also work for normal reference links with two pairs of square brackets.

[page 123][author2016:123]
[page 123][PDF#page=123]
[search for “value”][script?key=value]

Is there any existing extension like this? My quick test at Babelmark showed nothing. Pandoc’s citation format requires an at sign @ in front of the identifier, but may be more versatile overall.