Fancybox 3 using Figcaption Legends

By default Fancybox 3 uses picture legends from the option data-caption="Bildlegende" and doesn't support HTML formatted text. Using JQuery one can juse the legend from the HTML 5 tag <figcaption>. Nested <figure> are supported. The example shown in the original Fancybox 3 is wrong, because there the <a> anchor tag encloses the whole <figcaption>, which validator.w3.org reports as wrong.

<figure>
  <a href="/path/to/fullsize-picture.jpg" data-fancybox="fig">
    <img src="/path/to/thumbnail.jpg" width="100" height="100" alt="Picture" />
  </a>
  <figcaption>
    HTML formatierte Bildlegende mit <a href="#">Hyperlink.</a>.
  </figcaption>
</figure>

<script>
  $('[data-fancybox="fig"]').fancybox({
    caption : function(instance,item) {
      return $(this).closest('figure').find('figcaption').html();
    }
  });
</script>