This addresses a subsidiary issue in #3674.
with `--reference-links` and `--reference-location=section`. Also ensure that there are no empty link references `[]`. Closes #3674.