scriblib/figure: fix figures as ref targets

Merge to v6.0